<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Bizarre GSErrCode -2130312313 returned by ACAPI in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/Bizarre-GSErrCode-2130312313-returned-by-ACAPI/m-p/663782#M10403</link>
    <description>&lt;P&gt;Hi everyone:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;*MyPlugin&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|--------------A.dll(third party dll)&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|--------------B.dll(third party dll)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;*MyPlugin_Entrance-----real add-on,including&amp;nbsp;CheckEnvironment\RegisterInterface\Initialize\FreeData&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1,Above is my project structure.&amp;nbsp;&lt;/P&gt;&lt;P&gt;2,Part of the code in MyPlugin is as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;extern "C" _declspec(dllexport)
void	Export()
{
	API_ProjectInfo project_info;
	auto err = ACAPI_ProjectOperation_Project(&amp;amp;project_info);
	
	err = NoError;
	void* origSight;
	err = ACAPI_Sight_SelectSight(nullptr, &amp;amp;origSight);
	
	return ;
}&lt;/LI-CODE&gt;&lt;P&gt;3,Part of the code in MyPlugin_Entrance is as follows:&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;API_AddonType CheckEnvironment (API_EnvirParams* envir)
{
	RSGetIndString (&amp;amp;envir-&amp;gt;addOnInfo.name, ID_ADDON_INFO, 1, ACAPI_GetOwnResModule ());
	RSGetIndString (&amp;amp;envir-&amp;gt;addOnInfo.description, ID_ADDON_INFO, 2, ACAPI_GetOwnResModule ());

	return APIAddon_Preload;
}		// CheckEnvironment

//
typedef void (*PluginEntry)();
//
PluginEntry Do_Export = NULL;
//
static void LoadAssembly()
{
	std::string assembly_dir = GetExecutablDir();
	if (assembly_dir.empty())
		return;
	//
	std::vector&amp;lt;std::string&amp;gt; assemblys = { "A.dll", 									 
                                               "B.dll",										 
                                               "MyPlugin.apx"};

	for (size_t i = 0; i &amp;lt; assemblys.size(); i++)
	{
		auto assembly = assembly_dir + "/" + assemblys[i];
		//
		auto model = LoadLibrary(assembly.c_str());
		//get entry from plugin
		if (i == assemblys.size() - 1)
			Do_Export = (PluginEntry)GetProcAddress(model, "Export");
	}
}


GSErrCode ViewNotificationHandlerProc(const API_NotifyViewEventType* viewEvent)
{
	if (Do_Export)
	{
		Do_Export();
		return NoError;
	}

	return NoError;
}


GSErrCode Initialize	(void)
{
	//
	LoadAssembly();
	
	if (err == NoError)
		err = ACAPI_Notification_CatchViewEvent(APINotifyView_Opened, API_PublicViewMap, ViewNotificationHandlerProc);
	
	return NoError;
}		// Initialize


&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;The question is that ACAPI_ProjectOperation_Project and&amp;nbsp;ACAPI_Sight_SelectSight return&amp;nbsp;-2130312313 in function&amp;nbsp;Export().&lt;/P&gt;</description>
    <pubDate>Tue, 27 May 2025 08:38:40 GMT</pubDate>
    <dc:creator>sxs</dc:creator>
    <dc:date>2025-05-27T08:38:40Z</dc:date>
    <item>
      <title>Bizarre GSErrCode -2130312313 returned by ACAPI</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Bizarre-GSErrCode-2130312313-returned-by-ACAPI/m-p/663782#M10403</link>
      <description>&lt;P&gt;Hi everyone:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;*MyPlugin&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|--------------A.dll(third party dll)&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|--------------B.dll(third party dll)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;*MyPlugin_Entrance-----real add-on,including&amp;nbsp;CheckEnvironment\RegisterInterface\Initialize\FreeData&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1,Above is my project structure.&amp;nbsp;&lt;/P&gt;&lt;P&gt;2,Part of the code in MyPlugin is as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;extern "C" _declspec(dllexport)
void	Export()
{
	API_ProjectInfo project_info;
	auto err = ACAPI_ProjectOperation_Project(&amp;amp;project_info);
	
	err = NoError;
	void* origSight;
	err = ACAPI_Sight_SelectSight(nullptr, &amp;amp;origSight);
	
	return ;
}&lt;/LI-CODE&gt;&lt;P&gt;3,Part of the code in MyPlugin_Entrance is as follows:&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;API_AddonType CheckEnvironment (API_EnvirParams* envir)
{
	RSGetIndString (&amp;amp;envir-&amp;gt;addOnInfo.name, ID_ADDON_INFO, 1, ACAPI_GetOwnResModule ());
	RSGetIndString (&amp;amp;envir-&amp;gt;addOnInfo.description, ID_ADDON_INFO, 2, ACAPI_GetOwnResModule ());

	return APIAddon_Preload;
}		// CheckEnvironment

//
typedef void (*PluginEntry)();
//
PluginEntry Do_Export = NULL;
//
static void LoadAssembly()
{
	std::string assembly_dir = GetExecutablDir();
	if (assembly_dir.empty())
		return;
	//
	std::vector&amp;lt;std::string&amp;gt; assemblys = { "A.dll", 									 
                                               "B.dll",										 
                                               "MyPlugin.apx"};

	for (size_t i = 0; i &amp;lt; assemblys.size(); i++)
	{
		auto assembly = assembly_dir + "/" + assemblys[i];
		//
		auto model = LoadLibrary(assembly.c_str());
		//get entry from plugin
		if (i == assemblys.size() - 1)
			Do_Export = (PluginEntry)GetProcAddress(model, "Export");
	}
}


GSErrCode ViewNotificationHandlerProc(const API_NotifyViewEventType* viewEvent)
{
	if (Do_Export)
	{
		Do_Export();
		return NoError;
	}

	return NoError;
}


GSErrCode Initialize	(void)
{
	//
	LoadAssembly();
	
	if (err == NoError)
		err = ACAPI_Notification_CatchViewEvent(APINotifyView_Opened, API_PublicViewMap, ViewNotificationHandlerProc);
	
	return NoError;
}		// Initialize


&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;The question is that ACAPI_ProjectOperation_Project and&amp;nbsp;ACAPI_Sight_SelectSight return&amp;nbsp;-2130312313 in function&amp;nbsp;Export().&lt;/P&gt;</description>
      <pubDate>Tue, 27 May 2025 08:38:40 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Bizarre-GSErrCode-2130312313-returned-by-ACAPI/m-p/663782#M10403</guid>
      <dc:creator>sxs</dc:creator>
      <dc:date>2025-05-27T08:38:40Z</dc:date>
    </item>
    <item>
      <title>Re: Bizarre GSErrCode -2130312313 returned by ACAPI</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Bizarre-GSErrCode-2130312313-returned-by-ACAPI/m-p/663786#M10404</link>
      <description>&lt;P&gt;The code outside of &lt;SPAN&gt;ACAPI&lt;/SPAN&gt; in the function Export() can execute normally.&lt;/P&gt;</description>
      <pubDate>Tue, 27 May 2025 08:43:46 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Bizarre-GSErrCode-2130312313-returned-by-ACAPI/m-p/663786#M10404</guid>
      <dc:creator>sxs</dc:creator>
      <dc:date>2025-05-27T08:43:46Z</dc:date>
    </item>
    <item>
      <title>Re: Bizarre GSErrCode -2130312313 returned by ACAPI</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Bizarre-GSErrCode-2130312313-returned-by-ACAPI/m-p/663797#M10405</link>
      <description>&lt;P&gt;I dont know the errors reason. I didnt tried this infrastructure exactly as this.&lt;BR /&gt;And it very depend on how A.dll, B.dll work.&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN class="aNeGP0gI0B9AV8JaHPyH" data-src-align="0:5"&gt;Personally&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN class="aNeGP0gI0B9AV8JaHPyH" data-src-align="6:1"&gt;I&lt;/SPAN&gt; &lt;SPAN class="aNeGP0gI0B9AV8JaHPyH" data-src-align="8:2"&gt;would&lt;/SPAN&gt;&lt;SPAN&gt; have &lt;/SPAN&gt;&lt;SPAN class="aNeGP0gI0B9AV8JaHPyH" data-src-align="11:6"&gt;done&lt;/SPAN&gt;&lt;SPAN&gt; it &lt;/SPAN&gt;&lt;SPAN class="aNeGP0gI0B9AV8JaHPyH" data-src-align="18:5"&gt;differently&lt;/SPAN&gt;&lt;SPAN&gt;. All API specific code in real API Addon only.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If you can directly use functionality&amp;nbsp;A.dll, B.dll by GetProcAddress, MyPlugin will not needed.&lt;BR /&gt;If the MyPlugin.dll&amp;nbsp;&lt;SPAN class="aNeGP0gI0B9AV8JaHPyH" data-src-align="0:5"&gt;more&lt;/SPAN&gt; &lt;SPAN class="aNeGP0gI0B9AV8JaHPyH" data-src-align="6:6"&gt;convenient or needed, It will be like a high level "bridge" between the addon and a third-party dlls functionality and possible memory handling issues. The MyPlugin will not depends on API and not will linked to API.&amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;BR /&gt;PS:&amp;nbsp;&lt;SPAN class="aNeGP0gI0B9AV8JaHPyH" data-src-align="0:3"&gt;It&lt;/SPAN&gt;'s &lt;SPAN class="aNeGP0gI0B9AV8JaHPyH" data-src-align="4:2"&gt;not&lt;/SPAN&gt; &lt;SPAN class="aNeGP0gI0B9AV8JaHPyH" data-src-align="7:11"&gt;necessarily&lt;/SPAN&gt; &lt;SPAN class="aNeGP0gI0B9AV8JaHPyH" data-src-align="19:6"&gt;good&lt;/SPAN&gt; &lt;SPAN class="aNeGP0gI0B9AV8JaHPyH" data-src-align="26:1"&gt;or&lt;/SPAN&gt; &lt;SPAN class="aNeGP0gI0B9AV8JaHPyH" data-src-align="29:9"&gt;right&lt;/SPAN&gt;&lt;SPAN class="aNeGP0gI0B9AV8JaHPyH" data-src-align="38:1"&gt;,&lt;/SPAN&gt; &lt;SPAN class="aNeGP0gI0B9AV8JaHPyH" data-src-align="40:3"&gt;it&lt;/SPAN&gt;'s &lt;SPAN class="aNeGP0gI0B9AV8JaHPyH" data-src-align="44:6"&gt;just&lt;/SPAN&gt; &lt;SPAN class="aNeGP0gI0B9AV8JaHPyH" data-src-align="51:3"&gt;my&lt;/SPAN&gt; &lt;SPAN class="aNeGP0gI0B9AV8JaHPyH" data-src-align="55:6"&gt;personal&lt;/SPAN&gt; &lt;SPAN class="aNeGP0gI0B9AV8JaHPyH" data-src-align="62:6"&gt;opinion&lt;/SPAN&gt;&lt;SPAN class="aNeGP0gI0B9AV8JaHPyH" data-src-align="68:1"&gt;.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 27 May 2025 09:35:07 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Bizarre-GSErrCode-2130312313-returned-by-ACAPI/m-p/663797#M10405</guid>
      <dc:creator>Oleg</dc:creator>
      <dc:date>2025-05-27T09:35:07Z</dc:date>
    </item>
    <item>
      <title>Re: Bizarre GSErrCode -2130312313 returned by ACAPI</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Bizarre-GSErrCode-2130312313-returned-by-ACAPI/m-p/663798#M10406</link>
      <description>&lt;P&gt;Okay, thank you. You gave me some inspiration, I'll give it a try&lt;/P&gt;</description>
      <pubDate>Tue, 27 May 2025 09:52:33 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Bizarre-GSErrCode-2130312313-returned-by-ACAPI/m-p/663798#M10406</guid>
      <dc:creator>sxs</dc:creator>
      <dc:date>2025-05-27T09:52:33Z</dc:date>
    </item>
  </channel>
</rss>

