Page 1 of 1

Where to dim arrays for a .dylib ?

Posted: Thu Mar 19, 2015 7:38 am
by wilbert
The PB docs mention AttachProcess as the place to dim arrays and maps for windows.
Where should this be done for a OS X dylib ?
I want to dim some global arrays but have no clue where that should be done.

Re: Where to dim arrays for a .dylib ?

Posted: Thu Mar 19, 2015 8:56 am
by Danilo
You could make an Init function (All OS).

Re: Where to dim arrays for a .dylib ?

Posted: Thu Mar 19, 2015 9:21 am
by wilbert
Danilo wrote:You could make an Init function (All OS).
Is that allowed ?
The help file says
PureBasic Help wrote:The declaration of arrays, lists or map with Dim, NewList or NewMap must always be done inside the procedure AttachProcess.
If it can be done inside any procedure that would make things a lot easier.

Re: Where to dim arrays for a .dylib ?

Posted: Thu Mar 19, 2015 10:11 pm
by Fred
It can be done in any procedure, it was for "global" items. But I think that's history as you can put it outside and it should be automatically executed when the DLL loads (basically all code outside procedure is executed when the DLL loads).

Re: Where to dim arrays for a .dylib ?

Posted: Fri Mar 20, 2015 8:40 am
by wilbert
Fred wrote:It can be done in any procedure, it was for "global" items. But I think that's history as you can put it outside and it should be automatically executed when the DLL loads (basically all code outside procedure is executed when the DLL loads).
Thanks for clarifying. :)