cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
2024 Technology Preview Program

2024 Technology Preview Program:
Master powerful new features and shape the latest BIM-enabled innovations

Archicad C++ API
About Archicad add-on development using the C++ API.
SOLVED!

The parameter of BNZeroMemory should be trivially copyable

RAFD
Participant

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.

RAFD_0-1720672187060.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Solution
AllanP
Advocate

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.

 

 

 

I have been using ArchiCAD continually since ArchiCAD 4.5, 4.5.5, 5, 5.1, 6, 6.5, 7, 8, 8.1, 9, 10, 11, 12, 13, 15, 18, 21, 22, 25, now testing 27
Member of Architalk since 2003, but missed the migration to Graphisoft.
(where have all my original posts gone?)

View solution in original post

1 REPLY 1
Solution
AllanP
Advocate

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.

 

 

 

I have been using ArchiCAD continually since ArchiCAD 4.5, 4.5.5, 5, 5.1, 6, 6.5, 7, 8, 8.1, 9, 10, 11, 12, 13, 15, 18, 21, 22, 25, now testing 27
Member of Architalk since 2003, but missed the migration to Graphisoft.
(where have all my original posts gone?)