<?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 Re: Changing the Library folder in ARCHICAD12 in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/Changing-the-Library-folder-in-ARCHICAD12/m-p/167594#M6575</link>
    <description>I'm sorry, may be it's wrong topic.. Really I don't need to change Library folder. I need additional properties of project that can get via AutoText.&lt;BR /&gt;
But I have the same linker error.</description>
    <pubDate>Tue, 14 Apr 2009 12:49:48 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2009-04-14T12:49:48Z</dc:date>
    <item>
      <title>Changing the Library folder in ARCHICAD12</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Changing-the-Library-folder-in-ARCHICAD12/m-p/167574#M6555</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;Hi, &lt;BR /&gt;&lt;BR /&gt;I want to change my project Libraries Folder in ArchiCAD 12. &lt;BR /&gt;I am using following function. &lt;BR /&gt;&lt;BR /&gt;Void setupLibrariesForAC12() &lt;BR /&gt;{ &lt;BR /&gt;API_LibrariesInfo libInfo; &lt;BR /&gt;&lt;BR /&gt;memset(&amp;amp;libInfo, 0, sizeof(API_LibrariesInfo)); &lt;BR /&gt;libInfo.nLib = 2; &lt;BR /&gt;libInfo.locations = (IO::Location**) BMAllocateHandle (libInfo.nLib * sizeof(IO::Location, ALLOCATE_CLEAR, 0); &lt;BR /&gt;libInfo.useSatellite = false; &lt;BR /&gt;&lt;BR /&gt;new (*libInfo.locations) IO::Location (“C:\\Archicad12\\Archicad Library”); &lt;BR /&gt;new (*libInfo.locations + 1) IO::Location (“C:\\Archicad Development Library”); &lt;BR /&gt;&lt;BR /&gt;ACAPI_Environment(APIEnv_SetLibrariesID, &amp;amp;libInfo, NULL); &lt;BR /&gt;(*libInfo.locations).~Location(); &lt;BR /&gt;(*libInfo.locations + 1).~Location(); &lt;BR /&gt;&lt;BR /&gt;BMKillHandle(reinterpret_cast&amp;lt;GSHandle *&amp;gt; (&amp;amp;libInfo.locations)); &lt;BR /&gt;} &lt;BR /&gt;&lt;BR /&gt;But I am getting following errors &lt;BR /&gt;err LNK2001:unresolved external symbol “public: virtual class GS::ClassInfo * __thiscall GS::Object::GetClassInfoA(void)const “(?getClassInfoA@object@GS@@UBEPAVClassInfo@2@XZ) &lt;BR /&gt;fatal error LNK1120: 1 unresolved externals. &lt;BR /&gt;&lt;BR /&gt;Please help me to solve these errors.&lt;/DIV&gt;</description>
      <pubDate>Mon, 09 Sep 2024 08:54:13 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Changing-the-Library-folder-in-ARCHICAD12/m-p/167574#M6555</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-09-09T08:54:13Z</dc:date>
    </item>
    <item>
      <title>Re: Changing the Library folder in ARCHICAD12</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Changing-the-Library-folder-in-ARCHICAD12/m-p/167575#M6556</link>
      <description>&lt;BLOCKQUOTE&gt;Ranga wrote:&lt;BR /&gt;I want to change my project Libraries Folder in ArchiCAD 12. &lt;BR /&gt;
I am using following function. &lt;BR /&gt;
Void setupLibrariesForAC12() &lt;BR /&gt;
...etc...&lt;BR /&gt;
Please help me to solve these errors.&lt;/BLOCKQUOTE&gt;
Does the problem go away if you write it like this (i.e. changing just part of your function)?
&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;libInfo.locations = (IO::Location**) BMAllocateHandle (libInfo.nLib * sizeof(IO::Location, ALLOCATE_CLEAR, 0); 
libInfo.useSatellite = false; 

(*libInfo.locations)[0] = IO::Location(“C:\\Archicad12\\Archicad Library”);
(*libInfo.locations)[1] = IO::Location(“C:\\Archicad Development Library”);

ACAPI_Environment(APIEnv_SetLibrariesID, &amp;amp;libInfo, NULL); 

BMKillHandle(reinterpret_cast&amp;lt;GSHandle *&amp;gt; (&amp;amp;libInfo.locations)); 		
&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Feb 2009 15:01:25 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Changing-the-Library-folder-in-ARCHICAD12/m-p/167575#M6556</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2009-02-04T15:01:25Z</dc:date>
    </item>
    <item>
      <title>Re: Changing the Library folder in ARCHICAD12</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Changing-the-Library-folder-in-ARCHICAD12/m-p/167576#M6557</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
Have you GSRootImp.LIB in your project ?</description>
      <pubDate>Wed, 04 Feb 2009 15:19:34 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Changing-the-Library-folder-in-ARCHICAD12/m-p/167576#M6557</guid>
      <dc:creator>Oleg</dc:creator>
      <dc:date>2009-02-04T15:19:34Z</dc:date>
    </item>
    <item>
      <title>Re: Changing the Library folder in ARCHICAD12</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Changing-the-Library-folder-in-ARCHICAD12/m-p/167577#M6558</link>
      <description>&lt;BLOCKQUOTE&gt;Oleg wrote:&lt;BR /&gt;Hi,&lt;BR /&gt;
&lt;BR /&gt;
Have you GSRootImp.LIB in your project ?&lt;/BLOCKQUOTE&gt;

Oleg,&lt;BR /&gt;
&lt;BR /&gt;
What a good surprise to read you. It's a long time. I hope you are fine.&lt;BR /&gt;
Your GDL and API programmer expertise is missing. &lt;BR /&gt;
&lt;BR /&gt;
Kliment recently pointed out your "rxDuplicator" Add-On (AC8 &amp;amp; 9), among other jewels. &lt;BR /&gt;
Years after, the similar tool on AC12, is a bit poor, in comparison.&lt;BR /&gt;
&lt;BR /&gt;
May we expect from you a come back on AC-Talk?&lt;BR /&gt;
&lt;BR /&gt;
Cheers,&lt;BR /&gt;
Olivier</description>
      <pubDate>Wed, 04 Feb 2009 20:13:04 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Changing-the-Library-folder-in-ARCHICAD12/m-p/167577#M6558</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-02-04T20:13:04Z</dc:date>
    </item>
    <item>
      <title>Re: Changing the Library folder in ARCHICAD12</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Changing-the-Library-folder-in-ARCHICAD12/m-p/167578#M6559</link>
      <description>Hi Ralph Wessel,&lt;BR /&gt;
&lt;BR /&gt;
It is working fine if i use &lt;BR /&gt;
(*libInfo.locations)[0] = IO::Location("C:\\ArchiCAD 12\\ Archicad Library 12");&lt;BR /&gt;
&lt;BR /&gt;
but in the run time it is failing&lt;BR /&gt;
at line&lt;BR /&gt;
(*libInfo.locations)[0].~Location();&lt;BR /&gt;
&lt;BR /&gt;
i can't use the try and catch because it is saying "error C2712: Cannot use __try in functions that require object unwinding"&lt;BR /&gt;
&lt;BR /&gt;
i don't know what to do. can you please help me ranga</description>
      <pubDate>Thu, 05 Feb 2009 00:26:13 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Changing-the-Library-folder-in-ARCHICAD12/m-p/167578#M6559</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-02-05T00:26:13Z</dc:date>
    </item>
    <item>
      <title>Re: Changing the Library folder in ARCHICAD12</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Changing-the-Library-folder-in-ARCHICAD12/m-p/167579#M6560</link>
      <description>&lt;BLOCKQUOTE&gt;Olivier wrote:&lt;BR /&gt;
&lt;BR /&gt;
What a good surprise to read you. It's a long time. I hope you are fine.&lt;BR /&gt;
&lt;BR /&gt;
Olivier&lt;/BLOCKQUOTE&gt;

Hi Olivier and all, thanks for warm words. I am fine.&lt;BR /&gt;
I occasionally read the Talk, but I have no time to participate absolutely.&lt;BR /&gt;
( Also has almost forgotten English language in addition.  &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_smile.gif" style="display : inline;" /&gt;  )&lt;BR /&gt;
Good luck. I should disappear again.&lt;BR /&gt;
&lt;BR /&gt;
PS: Ranga, I am sorry for personal messages in your thread.&lt;BR /&gt;
&lt;BR /&gt;
Oleg</description>
      <pubDate>Thu, 05 Feb 2009 04:54:04 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Changing-the-Library-folder-in-ARCHICAD12/m-p/167579#M6560</guid>
      <dc:creator>Oleg</dc:creator>
      <dc:date>2009-02-05T04:54:04Z</dc:date>
    </item>
    <item>
      <title>Re: Changing the Library folder in ARCHICAD12</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Changing-the-Library-folder-in-ARCHICAD12/m-p/167580#M6561</link>
      <description>Hi Ranga,&lt;BR /&gt;
&lt;BR /&gt;
(I am sorry my English)&lt;BR /&gt;
&lt;BR /&gt;
I am not sure in following, just guessing.&lt;BR /&gt;
&lt;BR /&gt;
Actually, it seems is a right way:&lt;BR /&gt;
new (*libInfo.locations) IO::Location ("C:\\Archicad12\\Archicad Library"); &lt;BR /&gt;
new (*libInfo.locations + 1) IO::Location ("C:\\Archicad Development Library"); &lt;BR /&gt;
&lt;BR /&gt;
and then&lt;BR /&gt;
&lt;BR /&gt;
(*libInfo.locations)-&amp;gt;~Location(); &lt;BR /&gt;
(*libInfo.locations + 1)-&amp;gt;~Location(); &lt;BR /&gt;
&lt;BR /&gt;
But looking at Location header (Location class), there is :&lt;BR /&gt;
#if defined (DEBUVERS)&lt;BR /&gt;
	Int32*				leakDetector;&lt;BR /&gt;
#endif&lt;BR /&gt;
&lt;BR /&gt;
So, sizeof of Location class is different in Debug and Release build.&lt;BR /&gt;
And I think none of attemts will not work in Debug mode.&lt;BR /&gt;
&lt;BR /&gt;
Try your code in Release mode. It may works.&lt;BR /&gt;
I think only GS may explain this.&lt;BR /&gt;
May be there is a way #undef DEBUVERS in your cpp source before #includes, but not sure.&lt;BR /&gt;
&lt;BR /&gt;
Oleg</description>
      <pubDate>Thu, 05 Feb 2009 06:35:43 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Changing-the-Library-folder-in-ARCHICAD12/m-p/167580#M6561</guid>
      <dc:creator>Oleg</dc:creator>
      <dc:date>2009-02-05T06:35:43Z</dc:date>
    </item>
    <item>
      <title>Re: Changing the Library folder in ARCHICAD12</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Changing-the-Library-folder-in-ARCHICAD12/m-p/167581#M6562</link>
      <description>&lt;BLOCKQUOTE&gt;Ranga wrote:&lt;BR /&gt;Hi Ralph Wessel,&lt;BR /&gt;
&lt;BR /&gt;
It is working fine if i use &lt;BR /&gt;
(*libInfo.locations)[0] = IO::Location("C:\\ArchiCAD 12\\ Archicad Library 12");&lt;BR /&gt;
&lt;BR /&gt;
but in the run time it is failing&lt;BR /&gt;
at line&lt;BR /&gt;
(*libInfo.locations)[0].~Location();&lt;/BLOCKQUOTE&gt;
That line is directly calling the object's destructor. In the GS example, this is used because they have used placement new in order to directly call the object's constructor and specify where the object is to be allocated. If you take out the placement new (which was my suggestion) you no longer need to call the destructor - it will fail if you do (which is what you are seeing). Either use the code exactly as I stated or use the GS example, but don't mix them.&lt;BR /&gt;
&lt;BR /&gt;
I would like someone from GS to comment on this, because I don't see an obvious reason for using placement new to allocate the object. Anyone?</description>
      <pubDate>Thu, 05 Feb 2009 09:36:54 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Changing-the-Library-folder-in-ARCHICAD12/m-p/167581#M6562</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2009-02-05T09:36:54Z</dc:date>
    </item>
    <item>
      <title>Re: Changing the Library folder in ARCHICAD12</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Changing-the-Library-folder-in-ARCHICAD12/m-p/167582#M6563</link>
      <description>Hi Ralph,&lt;BR /&gt;
&lt;BR /&gt;
I agree, GS should comment all of this.&lt;BR /&gt;
&lt;BR /&gt;
My idea about destructor. &lt;BR /&gt;
&lt;BR /&gt;
I think it is correct:&lt;BR /&gt;
&lt;BR /&gt;
(*libInfo.locations)[0] = IO::Location("C:\\ArchiCAD 12\\ Archicad Library 12");&lt;BR /&gt;
&lt;BR /&gt;
I guess, placement new used only to avoid copy. Just to optimize.&lt;BR /&gt;
But I think, destructor needs anyway to avoid memory leak at kill handle.&lt;BR /&gt;
(*libInfo.locations)[0].~Location();&lt;BR /&gt;
&lt;BR /&gt;
And It is possible that will work for first member of array.&lt;BR /&gt;
But I think if DEBUVERS is defined then next items of array like &lt;BR /&gt;
(*libInfo.locations)[1] = IO::Location("C:\\ArchiCAD 12\\ Archicad  Library 12");&lt;BR /&gt;
will not work as copied at wrong place. But really it is correct, you are right.&lt;BR /&gt;
&lt;BR /&gt;
Intresting stuff. But have no time to test.&lt;BR /&gt;
&lt;BR /&gt;
Oleg</description>
      <pubDate>Thu, 05 Feb 2009 09:53:30 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Changing-the-Library-folder-in-ARCHICAD12/m-p/167582#M6563</guid>
      <dc:creator>Oleg</dc:creator>
      <dc:date>2009-02-05T09:53:30Z</dc:date>
    </item>
    <item>
      <title>Re: Changing the Library folder in ARCHICAD12</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Changing-the-Library-folder-in-ARCHICAD12/m-p/167583#M6564</link>
      <description>&lt;BLOCKQUOTE&gt;Oleg wrote:&lt;BR /&gt;I guess, placement new used only to avoid copy. Just to optimize.&lt;BR /&gt;
But I think, destructor needs anyway to avoid memory leak at kill handle.&lt;BR /&gt;
(*libInfo.locations)[0].~Location();&lt;/BLOCKQUOTE&gt;
The destructor call is only necessary if you have allocated the object with placement new. No memory will be leaked because it is has been allocated (and released) as a handle.&lt;BR /&gt;
&lt;BR /&gt;
There seems no reason to use placement new for allocation in this case. Yes, it is an 'optimisation', but completely pointless because this call would never be used in a context where optimal performance could make an appreciable difference.&lt;BR /&gt;
&lt;BR /&gt;
Optimising where there is no benefit, especially where is the code becomes less readable or balancing calls like 'new' and 'delete' are necessary, is both wasteful and risky. I would like to know if there is some other reason why the GS example does this.</description>
      <pubDate>Thu, 05 Feb 2009 10:02:46 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Changing-the-Library-folder-in-ARCHICAD12/m-p/167583#M6564</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2009-02-05T10:02:46Z</dc:date>
    </item>
    <item>
      <title>Re: Changing the Library folder in ARCHICAD12</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Changing-the-Library-folder-in-ARCHICAD12/m-p/167584#M6565</link>
      <description>The Location class may allocate some heap memory internally.&lt;BR /&gt;
Destructor call is necessary to release it by Location.&lt;BR /&gt;
I dont think the placement new is the reason.&lt;BR /&gt;
A handle is not typed array, like std::vecor or C++ array and destructor will not called automatically.&lt;BR /&gt;
&lt;BR /&gt;
Oleg</description>
      <pubDate>Thu, 05 Feb 2009 10:26:33 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Changing-the-Library-folder-in-ARCHICAD12/m-p/167584#M6565</guid>
      <dc:creator>Oleg</dc:creator>
      <dc:date>2009-02-05T10:26:33Z</dc:date>
    </item>
    <item>
      <title>Re: Changing the Library folder in ARCHICAD12</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Changing-the-Library-folder-in-ARCHICAD12/m-p/167585#M6566</link>
      <description>&lt;BLOCKQUOTE&gt;Ranga wrote:&lt;BR /&gt;I want to change my project Libraries Folder in ArchiCAD 12. I am using following function. &lt;BR /&gt;
Void setupLibrariesForAC12() &lt;BR /&gt;
{ etc...
&lt;/BLOCKQUOTE&gt;
Just for clarity, this function could be:&lt;PRE&gt;void setupLibrariesForAC12()
{ 
	API_LibrariesInfo libInfo; 
	
	memset(&amp;amp;libInfo, 0, sizeof(API_LibrariesInfo)); 
	libInfo.nLib = 2; 
	libInfo.locations = (IO::Location**) BMAllocateHandle (libInfo.nLib * sizeof(IO::Location, ALLOCATE_CLEAR, 0)); 
	libInfo.useSatellite = false; 
	
	(*libInfo.locations)[0] = IO::Location(“C:\\Archicad12\\Archicad Library”); 
	(*libInfo.locations)[1] = IO::Location(“C:\\Archicad Development Library”); 
	
	ACAPI_Environment(APIEnv_SetLibrariesID, &amp;amp;libInfo, NULL); 
	
	BMKillHandle(reinterpret_cast&amp;lt;GSHandle *&amp;gt; (&amp;amp;libInfo.locations)); 
} &lt;/PRE&gt;
Could someone from GS comment on whether the calls to placement new and the Location destructor are necessary for some internal initialisation or cleanup?&lt;BR /&gt;
&lt;BR /&gt;
Ranga, are you sure the link error is connected to this function, i.e. did it link properly previously? And have you linked to the correct libraries as Oleg suggested?</description>
      <pubDate>Thu, 05 Feb 2009 10:28:24 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Changing-the-Library-folder-in-ARCHICAD12/m-p/167585#M6566</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2009-02-05T10:28:24Z</dc:date>
    </item>
    <item>
      <title>Re: Changing the Library folder in ARCHICAD12</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Changing-the-Library-folder-in-ARCHICAD12/m-p/167586#M6567</link>
      <description>&lt;BLOCKQUOTE&gt;Oleg wrote:&lt;BR /&gt;The Location class may allocate some heap memory internally.&lt;BR /&gt;
Destructor call is necessary to release it by Location.&lt;BR /&gt;
I dont think the placement new is the reason.&lt;BR /&gt;
A handle is not typed array, like std::vecor or C++ array and destructor will not called automatically.&lt;/BLOCKQUOTE&gt;
Yes, the Location object may have allocated resources...  or may do so in future - perhaps it's also a safeguard against future changes?</description>
      <pubDate>Thu, 05 Feb 2009 10:31:02 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Changing-the-Library-folder-in-ARCHICAD12/m-p/167586#M6567</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2009-02-05T10:31:02Z</dc:date>
    </item>
    <item>
      <title>Re: Changing the Library folder in ARCHICAD12</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Changing-the-Library-folder-in-ARCHICAD12/m-p/167587#M6568</link>
      <description>&lt;BLOCKQUOTE&gt;Ralph wrote:&lt;BR /&gt;
Yes, the Location object may have allocated resources...  or may do so in future - perhaps it's also a safeguard against future changes?&lt;/BLOCKQUOTE&gt;

Yes, it may have as dynamically length of string path.&lt;BR /&gt;
But may it is just POD members so your right and desrtuctor is not necessary.&lt;BR /&gt;
&lt;BR /&gt;
Better if GS do special function like&lt;BR /&gt;
KillLocationHandle as there is for Prams etc.&lt;BR /&gt;
&lt;BR /&gt;
But more clear design if there will not mix C++ and C (as most struct is plain structs). &lt;BR /&gt;
Lets Location returns raw data state and has constructor from state.&lt;BR /&gt;
Location loc("tt");&lt;BR /&gt;
LocationState s = loc.GetState();&lt;BR /&gt;
Lovation l2(s);&lt;BR /&gt;
&lt;BR /&gt;
And Handle will be og LocationState.&lt;BR /&gt;
&lt;BR /&gt;
Or move to C++ and break untyped Handles.&lt;BR /&gt;
&lt;BR /&gt;
But I agree with Ralph, this puzzled direct destructor call is strange.</description>
      <pubDate>Thu, 05 Feb 2009 10:41:12 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Changing-the-Library-folder-in-ARCHICAD12/m-p/167587#M6568</guid>
      <dc:creator>Oleg</dc:creator>
      <dc:date>2009-02-05T10:41:12Z</dc:date>
    </item>
    <item>
      <title>Re: Changing the Library folder in ARCHICAD12</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Changing-the-Library-folder-in-ARCHICAD12/m-p/167588#M6569</link>
      <description>&lt;BLOCKQUOTE&gt;Oleg wrote:&lt;BR /&gt;Better if GS do special function like&lt;BR /&gt;
KillLocationHandle as there is for Prams etc.&lt;BR /&gt;
But more clear design if there will not mix C++ and C (as most struct is plain structs). &lt;/BLOCKQUOTE&gt;
I agree - this is messy. I guess AC (like most mature software) has to get by with some awkward scenarios as the new is built onto the old. I've sent an email asking for clarification on this one.&lt;BR /&gt;
&lt;BR /&gt;
Thinking about it, you are probably right. The Location object might either allocate resources or rely on reference counting to release resources when no object refers to them. Either way, explicitly releasing the object would be essential.</description>
      <pubDate>Thu, 05 Feb 2009 10:54:37 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Changing-the-Library-folder-in-ARCHICAD12/m-p/167588#M6569</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2009-02-05T10:54:37Z</dc:date>
    </item>
    <item>
      <title>Re: Changing the Library folder in ARCHICAD12</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Changing-the-Library-folder-in-ARCHICAD12/m-p/167589#M6570</link>
      <description>&lt;BLOCKQUOTE&gt;Ralph wrote:&lt;BR /&gt;
I agree - this is messy. I guess AC (like most mature software) has to get by with some awkward scenarios as the new is built onto the old. I've sent an email asking for clarification on this one.&lt;BR /&gt;
&lt;BR /&gt;
Thinking about it, you are probably right. The Location object might either allocate resources or rely on reference counting to release resources when no object refers to them. Either way, explicitly releasing the object would be essential.&lt;/BLOCKQUOTE&gt;

Yep, it does contain a few pointers, which have to be allocated correctly with a constructor call, and also does registration and un-registration as well.&lt;BR /&gt;
So, all in all, as Oleg said, the BM... routines didn't handle C++ classes correctly, so in some version of the API we have to get rid of them, and use C++-safe containers like GS::Array&amp;lt;&amp;gt;.&lt;BR /&gt;
In this special case the placement new and the placement delete are required because we store the instance of the C++ class in the non-typed handle, which of course doesn't call the destructor and the constructor.</description>
      <pubDate>Thu, 05 Feb 2009 15:39:58 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Changing-the-Library-folder-in-ARCHICAD12/m-p/167589#M6570</guid>
      <dc:creator>Akos Somorjai</dc:creator>
      <dc:date>2009-02-05T15:39:58Z</dc:date>
    </item>
    <item>
      <title>Re: Changing the Library folder in ARCHICAD12</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Changing-the-Library-folder-in-ARCHICAD12/m-p/167590#M6571</link>
      <description>&lt;BLOCKQUOTE&gt;Ralph wrote:&lt;BR /&gt;&lt;BLOCKQUOTE&gt;Ranga wrote:&lt;BR /&gt;I want to change my project Libraries Folder in ArchiCAD 12. I am using following function. &lt;BR /&gt;
Void setupLibrariesForAC12() &lt;BR /&gt;
{ etc...
&lt;/BLOCKQUOTE&gt;
Just for clarity, this function could be:&lt;PRE&gt;void setupLibrariesForAC12()
{ 
	API_LibrariesInfo libInfo; 
	
	memset(&amp;amp;libInfo, 0, sizeof(API_LibrariesInfo)); 
	libInfo.nLib = 2; 
	libInfo.locations = (IO::Location**) BMAllocateHandle (libInfo.nLib * sizeof(IO::Location, ALLOCATE_CLEAR, 0)); 
	libInfo.useSatellite = false; 
	
	(*libInfo.locations)[0] = IO::Location(“C:\\Archicad12\\Archicad Library”); 
	(*libInfo.locations)[1] = IO::Location(“C:\\Archicad Development Library”); 
	
	ACAPI_Environment(APIEnv_SetLibrariesID, &amp;amp;libInfo, NULL); 
	
	BMKillHandle(reinterpret_cast&amp;lt;GSHandle *&amp;gt; (&amp;amp;libInfo.locations)); 
} &lt;/PRE&gt;
Could someone from GS comment on whether the calls to placement new and the Location destructor are necessary for some internal initialisation or cleanup?&lt;BR /&gt;
&lt;BR /&gt;
Ranga, are you sure the link error is connected to this function, i.e. did it link properly previously? And have you linked to the correct libraries as Oleg suggested?&lt;/BLOCKQUOTE&gt;

hi Ralph,&lt;BR /&gt;
&lt;BR /&gt;
If I am using destructor I am getting Link error and If I am not using destructor No errors and and my code working fine(it setting new library).&lt;BR /&gt;
&lt;BR /&gt;
Ranga</description>
      <pubDate>Fri, 06 Feb 2009 01:51:36 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Changing-the-Library-folder-in-ARCHICAD12/m-p/167590#M6571</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-02-06T01:51:36Z</dc:date>
    </item>
    <item>
      <title>Re: Changing the Library folder in ARCHICAD12</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Changing-the-Library-folder-in-ARCHICAD12/m-p/167591#M6572</link>
      <description>&lt;BLOCKQUOTE&gt;Ranga wrote:&lt;BR /&gt;If I am using destructor I am getting Link error and If I am not using destructor No errors and and my code working fine(it setting new library).&lt;/BLOCKQUOTE&gt;
Based on the comments from Ákos, you really do need to use placement new and the destructor. Although the amount of memory leaked will probably be quite small, it's poor practice and might bite you later.&lt;BR /&gt;
&lt;BR /&gt;
I've compiled and linked a project using this function without problems, so I think your project is missing a library. I'm not sure which one is required in this case - I'm linking against the following in XCode:&lt;UL&gt;&lt;LI&gt;VBUtils.framework&lt;BR /&gt;
VBAttributes.framework&lt;BR /&gt;
UC.framework&lt;BR /&gt;
TextEngine.framework&lt;BR /&gt;
ProjectFile.framework&lt;BR /&gt;
PixMapIO.framework&lt;BR /&gt;
ObjectDatabase.framework&lt;BR /&gt;
ModelerGraphics.framework&lt;BR /&gt;
libACAP_STAT.a&lt;BR /&gt;
JACK.framework&lt;BR /&gt;
InputOutput.framework&lt;BR /&gt;
GX.framework&lt;BR /&gt;
GSZLib.framework&lt;BR /&gt;
GSXMLUtils.framework&lt;BR /&gt;
GSXML.framework&lt;BR /&gt;
GSUtils.framework&lt;BR /&gt;
GSRoot.framework&lt;BR /&gt;
GSQuickTime.framework&lt;BR /&gt;
GSModeler.framework&lt;BR /&gt;
Geometry.framework&lt;BR /&gt;
GDL.framework&lt;BR /&gt;
DG.framework&lt;BR /&gt;
AttributeManager.framework&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Sat, 07 Feb 2009 15:22:35 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Changing-the-Library-folder-in-ARCHICAD12/m-p/167591#M6572</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2009-02-07T15:22:35Z</dc:date>
    </item>
    <item>
      <title>Re: Changing the Library folder in ARCHICAD12</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Changing-the-Library-folder-in-ARCHICAD12/m-p/167592#M6573</link>
      <description>Hi!&lt;BR /&gt;
I've the same linker error:&lt;BR /&gt;
error LNK2001: unresolved external symbol "public: virtual class GS::ClassInfo * __thiscall GS::Object::GetClassInfoW(void)const " (?GetClassInfoW@Object@GS@@UBEPAVClassInfo@2@XZ)&lt;BR /&gt;
after that as added following code&lt;BR /&gt;
GS::Array&amp;lt;GS::ArrayFB&amp;lt;GS::UniString, 3&amp;gt;&amp;gt; autotexts;&lt;BR /&gt;
This is a peace of sample from API Development Kit help&lt;BR /&gt;
The "APIAny_GetAutoTextsID" topic&lt;BR /&gt;
Example:&lt;BR /&gt;
#include "UniString.hpp"&lt;BR /&gt;
#include "Array.hpp"&lt;BR /&gt;
&lt;BR /&gt;
GS::Array&amp;lt;GS::ArrayFB&amp;lt;GS::UniString, 3&amp;gt; &amp;gt; autotexts;&lt;BR /&gt;
API_AutotextType type = APIAutoText_Fixed;&lt;BR /&gt;
&lt;BR /&gt;
GSErrCode err = ACAPI_Goodies (APIAny_GetAutoTextsID, &amp;amp;autotexts, (void *) (long) type);&lt;BR /&gt;
if (err == NoError) {&lt;BR /&gt;
    for (ULong i = 0; i &amp;lt; autotexts.GetSize (); i++) {&lt;BR /&gt;
        DBPrintf ("AutoText[%03d] \"%s\" (\"%s\") = \"%s\"\n", i,&lt;BR /&gt;
            (const char *) autotexts&lt;I&gt;[0].ToCStr (), (const char *) autotexts&lt;I&gt;[1].ToCStr (), (const char *) autotexts&lt;I&gt;[2].ToCStr ());&lt;BR /&gt;
    }&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
Here is list of my libs:&lt;BR /&gt;
&lt;BR /&gt;
acap_stat.lib&lt;BR /&gt;
libcmtd.lib&lt;BR /&gt;
LIBCPMTD.LIB&lt;BR /&gt;
kernel32.lib&lt;BR /&gt;
advapi32.lib&lt;BR /&gt;
user32.lib&lt;BR /&gt;
GSRootImp.lib&lt;BR /&gt;
dgimp.lib&lt;BR /&gt;
InputOutputImp.lib&lt;BR /&gt;
libxml2.lib&lt;BR /&gt;
iconv.lib&lt;BR /&gt;
&lt;BR /&gt;
I tried include others libs that have GetClassInfo symbol, but it did not help.&lt;BR /&gt;
Hope to your help!&lt;BR /&gt;
&lt;BR /&gt;
Thanks in advance,&lt;BR /&gt;
AT&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;</description>
      <pubDate>Sun, 12 Apr 2009 17:46:41 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Changing-the-Library-folder-in-ARCHICAD12/m-p/167592#M6573</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-04-12T17:46:41Z</dc:date>
    </item>
    <item>
      <title>Re: Changing the Library folder in ARCHICAD12</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Changing-the-Library-folder-in-ARCHICAD12/m-p/167593#M6574</link>
      <description>Hi Apis Terrestris,&lt;BR /&gt;
&lt;BR /&gt;
	May be try this way, it may works.&lt;BR /&gt;
&lt;BR /&gt;
API_librariesInfo libInfo;&lt;BR /&gt;
OSErr err;&lt;BR /&gt;
&lt;BR /&gt;
memset(&amp;amp;libInfo, 0, sizeof(API_librariesInfo));&lt;BR /&gt;
err = ACAPI_Environment(API_Env_GetLibrariedId, &amp;amp;libInfo, NULL);&lt;BR /&gt;
if(err == noErr)&lt;BR /&gt;
{&lt;BR /&gt;
	for(int ii = 0; ii &amp;lt; libInfo.nLib; ++ii)&lt;BR /&gt;
{&lt;BR /&gt;
DBPrintf ("AutoText[%03d] = \"%s\"\n", i, GetCPathFromLocation(&amp;amp;(*libInfo.locations)[ii]));&lt;BR /&gt;
}&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
char * GetCpathFromLocation(IO::Location* location)&lt;BR /&gt;
{&lt;BR /&gt;
	static char static_path[MAX_Path];&lt;BR /&gt;
	IO::Path path;&lt;BR /&gt;
	&lt;BR /&gt;
	if(location-&amp;gt;ToPath(&amp;amp;path) == noErr)&lt;BR /&gt;
		strcpy(static_path, path);&lt;BR /&gt;
	else&lt;BR /&gt;
		static_path[0] = ‘\0’;&lt;BR /&gt;
	return static_path;&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
I will try differently with example ‘APIAny_GetAutoTextsID’ and if it works for me I will get back to you.</description>
      <pubDate>Tue, 14 Apr 2009 03:24:12 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Changing-the-Library-folder-in-ARCHICAD12/m-p/167593#M6574</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-04-14T03:24:12Z</dc:date>
    </item>
  </channel>
</rss>

