If I follow these rules, that isn't allowed:Notes about creating DLL's:
- The declaration of arrays, lists or map with Dim, NewList or NewMap must always be done inside the procedure AttachProcess.
- Don't write program code outside procedures. The only exception is the declaration of variables or structures.
- DirectX initialization routines must not be written in the AttachProcess procedure.
Code: Select all
Procedure Test()
Protected NewList MyList.s()
...
EndProcedure
Code: Select all
Procedure AttachProcess(Instance)
Global NewList MyList.s()
EndProcedure
Procedure Test()
... MyList() ...
EndProcedure
This way is incorrect, because code exists outside procedures:
Code: Select all
Procedure AttachProcess(Instance)
Global NewList MyList.s()
EndProcedure
CompilerIf #PB_Compiler_OS <> #PB_OS_Windows
AttachProcess(0)
CompilerEndIf
Procedure Test()
... MyList() ...
EndProcedure
Code: Select all
OpenLibrary(0, "DLLPath")
CompilerIf #PB_Compiler_OS <> #PB_OS_Windows
CallFunction(0, "AttachProcess", 0)
CompilerEndIf
...