I would to write a parser or a library for Purebasic. I can use these functions :
CallCFunction
CallCFunctionFast
CallFunction
CallFunctionFast
CloseLibrary
CountLibraryFunctions
ExamineLibraryFunctions
GetFunction
GetFunctionEntry
IsLibrary
LibraryFunctionAddress
LibraryFunctionName
LibraryID
NextLibraryFunction
OpenLibrary
So an example is given by Purebasic team :
[code]CompilerSelect #PB_Compiler_OS
CompilerCase #PB_OS_Windows
If OpenLibrary(0, “USER32.DLL”)
*MessageBox = GetFunction(0, “MessageBoxA”)
If *MessageBox
CallFunctionFast(*MessageBox, 0, “Body”, “Title”, 0)
EndIf
CloseLibrary(0)
EndIf
CompilerCase #PB_OS_Linux
If OpenLibrary(0, “libc.so”)
*MAlloc = GetFunction(0, “malloc”)
If *MAlloc
*Buffer = CallCFunctionFast(*MAlloc, 128)
If *Buffer
Debug “Buffer allocated”
CallCFunction(0, “free”, *Buffer)
EndIf
EndIf
CloseLibrary(0)
EndIf
CompilerEndSelect
[/code]
Do you think I could easely use Velleman.Velbus.dll with these functions ?
If someone could help me to develop this module, I will give it as an open-source or something for all Purebasic users (free of course).
Edit : I’ve try this (part) of code
[code]Enumeration
#Bibliotheque
EndEnumeration
NomFichier$ = “D:\telechargement\Domotique\Velbus\VelbusLib\Velbus\bin\Release\Velleman.Velbus.dll”
IncludeFile “Common.pb”
Resultat = OpenLibrary(#Bibliotheque, NomFichier$)
Debug Resultat
Resultat = OpenLibrary(#Bibliotheque, NomFichier$)
Debug Resultat --> OK
Debug IsLibrary(#Bibliotheque) --> OK
Debug CountLibraryFunctions(#Bibliotheque) --> 0 (!)
Debug ExamineLibraryFunctions(#Bibliotheque) --> -1 (!)
Debug GetFunction(#Bibliotheque, “Velleman.Velbus.bus.SendBlocking”) --> 0 (!)
Debug GetFunction(#Bibliotheque, “bus.SendBlocking”) --> 0 (!)
[/code]
and I have 0 or -1 (non existant or null) for last call functions