I'm migrating a legacy application from PB8 to PB 2019R3.
The app makes use of a DLL called mnutil.dll that was written in-house in C many years ago. The PB8 version of the app works happily enough on Win 10 currently, but I'm having issues with the DLL in PB 2019.
At runtime (both from within PB 2019 and when running the 32-bit exe), I'm getting an error 'Error opening DLL library mnutil.dll for external function...'
I have the mnutil.dll file sitting in the same folder as the application PBLs and the app all builds nicely in PB. I've tried adding the folder to the PATH too, but that makes no difference, so I'm assuming the error is not because it can't find the file.
The external function definition looks like this:
FUNCTION int GenMNPassword(ref string sip, ref string sop, long nopbuf) LIBRARY "Mnutil.dll" alias for "GenMNPassword;Ansi"
The DLL source code for that function looks like this:
int FAR PASCAL GenMNPassword(char far* szInput, char far* szOutput, long nOPBufSize)
{ ...
Finally, the Powerscript code calling the function looks like this:
string ls_input, ls_output
integer li_ret
ls_output = Space(32)
ls_input = (stext)
li_ret = GenMNPassword(ls_input, ls_output, 31)
Return ls_output
Can anyone offer any advice on where to look next? Thanks!!!
Yes, newer PB's no longer support the Pascal calling convention. You have us the _STDCALL mechanism. PB used to support Pascal when the PB IDE & Runtime were built using the WatcomC/C++ compiler (PowerSoft days) but Sybase swapped that out for the Microsoft C/C++ compiler in newer PB versions.
FYI: https://docs.appeon.com/pb2019/application_techniques/ch23s01.html
Regards ... Chris