cancel
Showing results for 
Search instead for 
Did you mean: 
EN
cancel
Showing results for 
Search instead for 
Did you mean: 
mick-donald
Participant

BNZeromemory Error in Archicad 27

Hello everyone.
I have this error when I use functions for ArchiCAD 26 to Archicad 27.
The functions are used for creating attributes, properties, walls, and slabs.
It is working well in Archicad 26 but there is such error in Archicad 27.
If anyone has an opinion or experience with this error, please help me.
----------------------------error----------------------------------------------
Static assertion failed due to requirement 'GS::IsVoid<API_ServerApplicationInfo> || GS::IsTriviallyCopyable<API_ServerApplicationInfo>': The parameter of BNZeroMemory should be trivially copyable.
1 Solution

Accepted Solutions
Viktor Kovacs
Graphisoft
Graphisoft

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

 

 

Go to post

2 Replies 2
Viktor Kovacs
Graphisoft
Graphisoft

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

 

 

kolioi
Booster

Actually this code is redundant

#ifndef ServerMainVers_2700
    BNZeroMemory (&appInfo, sizeof (appInfo));
#endif

I've been using initializer list instead of BNZeroMemory or templated BNClear and it works fine since AC24 (I haven't tried with AC23 and older versions). Also, since C++ 11 the equal sign is optional, i.e.

API_ServerApplicationInfo appInfo{};

is enough.

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!