OpenLibrary() works from IDE but not executable
Posted: Sun Sep 25, 2022 7:17 pm
I have a shared library (created in PB[C]) that I can successfully load and call from my code in the PB IDE but when I compile my program (also PB[C]) it then fails to load the library.
Any ideas what the problem could be?
Any ideas what the problem could be?
Code: Select all
Prototype Prototype_ServerStart(nPort, *sRootDir, *RouterFunction, *FreeFunction, *ErrorFunction)
Prototype Prototype_ServerStop()
Global ServerStart.Prototype_ServerStart
Global ServerStop.Prototype_ServerStop
Global sLibName.s = "appserver.so"
CompilerSelect #PB_Compiler_OS
CompilerCase #PB_OS_Windows
sLibName = "appserver.dll"
CompilerEndSelect
Global server_lib = OpenLibrary(#PB_Any, sLibName)
If server_lib
ServerStart = GetFunction(server_lib, "ServerStart")
ServerStop = GetFunction(server_lib, "ServerStop")
Else
MessageRequester("Error", "Failed to load library", 0)
End
EndIf