2024-07-11 06:31 AM - last edited on 2024-07-12 09:19 AM by Laszlo Nagy
I've been trying to convert a AC26 add-on to AC27 and got this error message. It works well in AC26.
Here's my code.
Solved! Go to Solution.
2024-07-11 06:54 AM - edited 2024-07-11 06:56 AM
There is an article from earlier this year about it
Viktor Kovacs from Graphisoft explains the change here:
Earlier every Archicad struct was a POD type, so it was safe - and actually recommended - to call BNZeroMemory on them to initialize the object. Since the API is getting more and more modern, now there are some non-POD objects where it is not safe to zero the memory since it will corrupt the data structure.
The error you get means that you shouldn't call BNZeroMemory on the API_ServerApplicationInfo struct anymore. So you can safely skip the BNZeroMemory call since the constructor will do the initialization.
You may still want to call BNZeroMemory if you are targeting older Archicad versions, in this case this code will do the trick:
API_ServerApplicationInfo appInfo = {};
#ifndef ServerMainVers_2700
BNZeroMemory (&appInfo, sizeof (appInfo));
#endif
https://community.graphisoft.com/t5/Archicad-C-API/BNZeromemory-Error-in-Archicad-27/td-p/584809
I hope this helps.
2024-07-11 06:54 AM - edited 2024-07-11 06:56 AM
There is an article from earlier this year about it
Viktor Kovacs from Graphisoft explains the change here:
Earlier every Archicad struct was a POD type, so it was safe - and actually recommended - to call BNZeroMemory on them to initialize the object. Since the API is getting more and more modern, now there are some non-POD objects where it is not safe to zero the memory since it will corrupt the data structure.
The error you get means that you shouldn't call BNZeroMemory on the API_ServerApplicationInfo struct anymore. So you can safely skip the BNZeroMemory call since the constructor will do the initialization.
You may still want to call BNZeroMemory if you are targeting older Archicad versions, in this case this code will do the trick:
API_ServerApplicationInfo appInfo = {};
#ifndef ServerMainVers_2700
BNZeroMemory (&appInfo, sizeof (appInfo));
#endif
https://community.graphisoft.com/t5/Archicad-C-API/BNZeromemory-Error-in-Archicad-27/td-p/584809
I hope this helps.