For the record:
From Jared:
"The problem is in the way exported
functions in your DLL are named. The name of the function you need to call is
actually _pft_IsOptionActivated@24 in the list of exported functions. Most
likely, this occurs because of the way this DLL is compiled - it must match the
stdcall calling convention (as, for example, Windows API functions do). I
guess, this is something your developers should look into.
Anyway, currently, to define your function
in the DLL, you need to use the following code:
Call Def_DLL.DefineProc("_pft_IsOptionActivated@24",
vt_int, vt_int, vt_int, vt_int, vt_int, vt_byref OR vt_bool, vt_void)
Once you do this, the wrapper object
created for your DLL in TC will have a method named zpft_IsOptionActivated_24.
This is because some characters (@ in this case) are replaced with underscores
to create a valid identifier. The underscore the the beginning of the name is
replaced with a 'z' to make the identifier VBScript-compatible (VBScript
doesn't allow starting identifiers with underscores).
To call your function, use the following
code:
Call lib.zpft_IsOptionActivated_24(0, 0, 0,
15, 1, activated)"
My Code that works now:
Options Explicit
Sub TestCallDll
Dim Def_Environment, Def_DLL, activated, lib
Set Def_Environment = DLL.DefineEnvironment(True)
Set Def_DLL = Def_Environment.DefineDLL("MetrinoPlatformWin32")
Call Def_DLL.DefineProc("_pft_IsOptionActivated@24", vt_int, vt_int, vt_int, vt_int, vt_int, vt_byref OR vt_bool, vt_void)
Set lib = Def_Environment.Load("C:\Program Files\Common Files\Gerico\Bin\MetrinoPlatformWin32.dll")
Call lib.zpft_IsOptionActivated_24(0, 0, 0, 15, 1, activated)
End Sub
Thanks to Jared.
Aurélien