cancel
Showing results for 
Search instead for 
Did you mean: 
EN
cancel
Showing results for 
Search instead for 
Did you mean: 
RAFD
Participant

The parameter of BNZeroMemory should be trivially copyable

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 Solution

Accepted Solutions
AllanP
Expert

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
Member of Architalk since 2003, but missed the migration from Architalk to Graphisoft Communities. Melbourne, Australia

Go to post

1 Reply 1
AllanP
Expert

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
Member of Architalk since 2003, but missed the migration from Architalk to Graphisoft Communities. Melbourne, Australia

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!