Problem with wrapping a library
Posted: Thu Sep 10, 2020 8:06 pm
Yo! I am back to PB after some time of absence. I am wrapping a Windows DLL that is written in C ++ to be used with PB. I will show you the fragment of the documentation and then my attempt to wrap it. The DLL compiles, even the log is created if I call the DLL from another application, but the other functions are not executed.
Here is the fragment of the library's documentation
int Initial(wchar_t* appkey, wchar_t* seckey, ZDCloudAPICallBack zdcCallBack)
typedef void(WINAPI *ZDCloudAPICallBack)(int type);
[out] int type
int SpeakAsync(wchar_t* text, BOOL bWindowChangedStop)
And now my prototype definitions:
int SpeakAsync(wchar_t* text, BOOL bWindowChangedStop)
Below I am showing the procedure that is called on attaching my DLL to the current process:
It seems like the "Initial" function is not even called properly.
I am sorry for this chaotic post, but I really look desperately for the solution. I have tried using a "p-unicode" parameter instead of wchar_t, but that didn't work either.
The use of normal strings is the result of my todays battle with the problem.
// Edit: Code-Tags added (Kiffi)
Here is the fragment of the library's documentation
int Initial(wchar_t* appkey, wchar_t* seckey, ZDCloudAPICallBack zdcCallBack)
typedef void(WINAPI *ZDCloudAPICallBack)(int type);
[out] int type
int SpeakAsync(wchar_t* text, BOOL bWindowChangedStop)
And now my prototype definitions:
int SpeakAsync(wchar_t* text, BOOL bWindowChangedStop)
Below I am showing the procedure that is called on attaching my DLL to the current process:
Code: Select all
ProcedureDLL AttachProcess(Instance)
OpenLibrary(0, "ZDCloudAPI.dll")
Initial = GetFunction(0, "Initial")
UnInitial = GetFunction(0, "UnInitial")
SpeakAsync = GetFunction(0, "SpeakAsync")
StopSpeak = GetFunction(0, "StopSpeak")
CreateFile(1, "log.txt")
result = Initial("apikey","secretkey",#Null)
WriteInteger(1, result)
EndProcedure
I am sorry for this chaotic post, but I really look desperately for the solution. I have tried using a "p-unicode" parameter instead of wchar_t, but that didn't work either.
The use of normal strings is the result of my todays battle with the problem.
// Edit: Code-Tags added (Kiffi)