BIM Coordinator Program (INT) April 22, 2024

Find the next step in your career as a Graphisoft Certified BIM Coordinator!

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

ARCHICAD 12 . how to allocate Memory for [uchar_t*]

Anonymous
Not applicable
I am trying to convert an API from Archicad 9 to Arhicad 12.

When I was trying to write some data into a GDL's string parameter. I used to do this:

chgParam.uStrValue=BMAllocatePtr(strlen(strValue)+1,ALLOCATE_CLEAR,0);
CHCopyC(strValue,chgParam.uStrValue);

where (chgParam )is of type [API_ChangeParamType]
and (strValue )is of type [char*] which is dynamically created from XML


However, in Archicad 12, (chgParam.uStrValue) became a type of [uchar_t* ] and I cant use BMAllocatePtr to allocate the correct size of memory to it before copying the data across through CHCopyC.

What function should I use in the lastest API to assign memory for (chgParam.uStrValue), or simply, what is the alternative way to make ArchiCAD12 works with the above 2 statements.

Thanks
Alfred
2 REPLIES 2
Ralph Wessel
Mentor
ALFREDMAN wrote:
I used to do this:
chgParam.uStrValue=BMAllocatePtr(strlen(strValue)+1,ALLOCATE_CLEAR,0);
However, in Archicad 12, (chgParam.uStrValue) became a type of [uchar_t* ] and I cant use BMAllocatePtr to allocate the correct size of memory
Continue to use BMAllocatePtr for allocation and then cast the result as required with reinterpret_cast.
Ralph Wessel BArch
Anonymous
Not applicable
Many thanks Ralph! I will try to keep going with my version conversion with this advice. Thanks. I now ran into problem of launching ArchiCAD from visualStudio 2005 in debug mode. Apart from setting "C:\Program Files\Graphisoft\ArchiCAD 13\ArchiCAD.exe" in the [Command] column inside the Debugging Tab of the Project Property Page, what else I need to do?


Alfred
Learn and get certified!

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!