%thinBasic_ReturnNone = &h0 %thinBasic_ReturnCodeByte = &h1 %thinBasic_ReturnCodeInteger = &h2 %thinBasic_ReturnCodeWord = &h3 %thinBasic_ReturnCodeDWord = &h4 %thinBasic_ReturnCodeLong = &h5 %thinBasic_ReturnCodeQuad = &h6 %thinBasic_ReturnCodeSingle = &h7 %thinBasic_ReturnCodeDouble = &h8 %thinBasic_ReturnCodeCurrency = &h9 %thinBasic_ReturnCodeExt = &h10 %thinBasic_ReturnNumber = &h20 %thinBasic_ReturnString = &h30 Declare Function FunctionGetPtr Lib "thinCore.dll" Alias "thinBasic_FunctionGetPtr" (ByVal fName As String) As Long Declare Function thinBasic_LoadSymbol Lib "thinCore.dll" Alias "thinBasic_LoadSymbol" (ByVal SymbolName As String, ByVal ReturnCode As Long, ByVal FunctionOrSubPointer As Dword, Optional ByVal ForceOverWrite As Long) As Long Declare Function thinBasic_Class_Add Lib "thinCore.dll" Alias "thinBasic_Class_Add" (ByVal sClassName As String, ByVal pClassFunc As Long) As Long Declare Function thinBasic_Class_AddMethod Lib "thinCore.dll" Alias "thinBasic_Class_AddMethod" (ByVal pClass As Long, ByVal sMethodName As String, ByVal MethodReturnType As Long, ByVal pMethodFunc As Long) As Long Local RetCode As Long TYPE IrrlichtDevice DWORD run As Long END TYPE Local IrrlichtDevicePtr As Long = thinBasic_Class_Add("IrrlichtDevice", Function_GetPtr(IrrlichtDevice_run)) If IrrlichtDevicePtr Then RetCode = thinBasic_Class_AddMethod(IrrlichtDevicePtr, "run", %thinBasic_ReturnNumber, Function_GetPtr(IrrlichtDevice_run)) RetCode = thinBasic_Class_AddMethod(IrrlichtDevicePtr, "getVersion", %thinBasic_ReturnString, Function_GetPtr(IrrlichtDevice_getVersion)) Else Uses "console" PrintL "ERROR thinBasic_Class_Add IrrlichtDevice" End If
I'm trying to do so and it might work, but is not suitable for Function_GetPtr code (and TYPE are also under suspicion). Here is the correct function for passing a pointer?
Bookmarks