2009-02-04
07:53 AM
- last edited on
2024-09-09
10:54 AM
by
Doreena Deng
2009-02-04 04:01 PM
Ranga wrote:Does the problem go away if you write it like this (i.e. changing just part of your function)?
I want to change my project Libraries Folder in ArchiCAD 12.
I am using following function.
Void setupLibrariesForAC12()
...etc...
Please help me to solve these errors.
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, &libInfo, NULL); BMKillHandle(reinterpret_cast<GSHandle *> (&libInfo.locations));
2009-02-04 04:19 PM
2009-02-04 09:13 PM
Oleg wrote:Oleg,
Hi,
Have you GSRootImp.LIB in your project ?
2009-02-05 01:26 AM
2009-02-05 05:54 AM
Olivier wrote:Hi Olivier and all, thanks for warm words. I am fine.
What a good surprise to read you. It's a long time. I hope you are fine.
Olivier
2009-02-05 07:35 AM
2009-02-05 10:36 AM
Ranga wrote: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.
Hi Ralph Wessel,
It is working fine if i use
(*libInfo.locations)[0] = IO::Location("C:\\ArchiCAD 12\\ Archicad Library 12");
but in the run time it is failing
at line
(*libInfo.locations)[0].~Location();
2009-02-05 10:53 AM
2009-02-05 11:02 AM
Oleg wrote: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.
I guess, placement new used only to avoid copy. Just to optimize.
But I think, destructor needs anyway to avoid memory leak at kill handle.
(*libInfo.locations)[0].~Location();