Re: TBDI - DirectInput Joystick module
Hi Mike,
I don't understand if TBDI_Close is your internal function or thinBASIC keyword.
I think for de-initialization part of thinBASIC module is dedicated function called UnLoadLocalSymbols.
It looks something like this in SDK template:
[code=thinbasic]
'----------------------------------------------------------------------------
FUNCTION UnLoadLocalSymbols ALIAS "UnLoadLocalSymbols" () EXPORT AS LONG
' This function is automatically called by thinCore whenever this DLL is unloaded.
' This function CAN be present but it is not necessary. If present, this function
' will be executed by thinBasic core when module will be released.
' Use this function to perform uninitialize process, if needed.
'----------------------------------------------------------------------------
'---
'Add here DeInitialization code if needed
'---
FUNCTION = 0&
END FUNCTION
[/code]
I don't use LibMain at all. But maybe I get your problem wrong.
Anyway, have a nice day ( and dinner :) ),
Petr
Re: TBDI - DirectInput Joystick module
Dooo ::)
You are right. Instead of using the attach and detach processes, I could probably use the load and unload functions to initialize it. Thanks for the tip. If it still not works, then I bite into the table :D
Re: TBDI - DirectInput Joystick module
Double dooooo ::) Eros allready mentioned Petr's tip. Man, I am sooooo blind. 8) It is a wonder that I ever get things done. :-[
Re: TBDI - DirectInput Joystick module
Hi Mike,
thanks a lot. Feel free to send me whatever you want me to check.
As Petr suggested, thinBasic do not handle LIBMAIN function. That function is handled automatically by the operating system.
thinBasic execute LoadLocalSymbols function at module calling and UnLoadLocalSymbols function when script stop execution.
Ciao
Eros
PS: you are too fast to post !!! :D
Re: TBDI - DirectInput Joystick module
Using LIBMAIN can be too late or too early because thinCore is not aware of what is going on at that precise time.
That's why we introduced LoadLocalSymbols and UnLoadLocalSymbols. thinCore is responsible to call them exactly when needed. And at that time all global variables inside the script are already there.
Another reason is to hide internal module development to users trying to check internal functions. Only LoadLocalSymbols and UnLoadLocalSymbols are exported. This will keep thinBasic modules usable only by thinBasic interface because all is internal executed by code pointers to functions.
Ciao
Eros