Question about dll creation: arrays as parameter and answer

Just starting out? Need help? Post your questions and find answers here.
eNano
User
User
Posts: 13
Joined: Wed Jun 05, 2024 4:48 pm

Question about dll creation: arrays as parameter and answer

Post by eNano »

Hi everyone, this is my first post on the forum.
I don't have too much experience coding but I'm learning about dll creation in pb and I have a big doubt: if I have an array in the source code and somehow I pass the array pointer to a dll function as a parameter, can I re-dim that array from the dll?
I have a 0 sized array in the main code, and I need to generate float numbers inside a dll function, but I don't know how much numbers I need to return from there so I can't have the size predefined. Which would be the best way to do that?
I really spent time looking for dll realted questions but I can't find anything about that, thanks a lot for any clue!
User avatar
mk-soft
Always Here
Always Here
Posts: 6206
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Question about dll creation: arrays as parameter and answer

Post by mk-soft »

The memory management of the main programme and the DLL are separate. Thus arrays (DIM) do not have the same range.
Here it is better to work with pointers, structures and AllocateMemory.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Post Reply