7 hours ago
Hi!
I've come across this weird issue where Archicad crashes in my Debug builds when I request the OrganizationId of the user. I was able to pinpoint that the issue only happens when linking to ACAP_STATD.lib. If I use ACAP_STAT.lib (as I usually do only for Release builds) then the issue doesn't happen.
And I've further figured out that the return value of GetOrganizationIds() is not properly initialized in ACAP_STATD.lib. Here's some example code to show this:
auto gsid = ACAPI::CreateGSIDObject ();
if (gsid.IsErr ()) { return APIERR_GENERAL; }
auto maybeOrganizationIds = gsid->GetOrganizationIds ();
if (maybeOrganizationIds.IsErr ()) { return APIERR_GENERAL; }
// For AC27 & AC28 this outputs the following depending on linked ACAPI library
// ACAP_STAT.lib: "Initialized: 1"
// ACAP_STATD.lib: "Initialized: 0"
ACAPI_WriteReport ("Initialized: %d", true, maybeOrganizationIds.Storage ().initialized_);
In AC26 the same crash happens with ACAPI_Protection_GetGSIDOrganizationIds().
I've only tested on Windows so far.
Here's a summary table of my results:
Archicad API DevKit Version | Linked To ACAP_STAT.lib | Linked To ACAP_STATD.lib |
26.7000 Win |
no crash | crashes |
27.6003 Win | no crash | crashes |
28.3001 Win | no crash | crashes |
Can someone else reproduce this behavior or even knows a fix?
Best,
Bernd
4 hours ago - last edited 4 hours ago
The issue happens because the ITERATOR_DEBUG_LEVEL values of Archicad and the Add-On are different (Archicad is a final build, the Add-On is a debug build). This cause problems only if there are standard library containers on the called interface.
Because of this issue it's not recommended anymore to use ACAP_STATD.lib, and you also need to set the ITERATOR_DEBUG_LEVEL to 0 in your Add-On.
Please see this change on how to update your configuration:
3 hours ago
Thanks Viktor for the detailed answer!
I'm a bit concerned that having to switch to MultiThreadedDLL & ACAP_STAT.lib also in Debug builds might interfere with the debug information and thus in my debugging workflow. But I'll give it a try and report back.