I can load dynamic FBSound and other libraries like so: (NOTE: no ".dll" or ".so" needed)
Code: Select all
#ifndef __FB_64BIT__
hFBS = DyLibLoad( "fbsound-32" )
if hFBS=0 then print "error: lib fbsound-32 not loaded !" : exit sub
#else
hFBS = DyLibLoad( "fbsound-64" )
if hFBS=0 then print "error: lib fbsound-64 not loaded !" : exit sub
#endif
Code: Select all
#ifndef __FB_64BIT__
hFltkCLib = DyLibLoad("fltk-c-1.3.3-32.dll")
#else
hFltkCLib = DyLibLoad("fltk-c-1.3.3-64.dll")
#endif
Compiled with -g and a gdb session does not show a error message or any unresolved references.
Joshy
here are the full sequence of the none working code:
Code: Select all
dim shared as any ptr hFltkCLib
sub FLTK_OOP_RuntimeUnload destructor
if hFltkCLib then DyLibFree(hFltkCLib) : hFltkCLib = 0
end sub
sub FLTK_OOP_RuntimeLoad constructor
#if defined(__FB_DARWIN__) or defined(__FB_DOS__)
#error 666: Target host must be a Windows or Linux PC or ARM6 device !
#else
#ifndef __FB_64BIT__
#ifndef __FB_ARM__
#define FLTK_C_LIBNAME "fltk-c-1.3.3-32"
#else
#define FLTK_C_LIBNAME "fltk-c-1.3.3-32-arm"
#endif
#else
#define FLTK_C_LIBNAME "fltk-c-1.3.3-64"
#endif
#endif
var oldPath = CurDir()
Chdir(ExePath()) ' <--- I tried this also without success
if hFltkCLib then exit sub
hFltkCLib = DyLibLoad(FLTK_C_LIBNAME)
if hFltkCLib=0 then
print "fatal error: " & FLTK_C_LIBNAME & " not loaded !"
beep : sleep : end 1
end if
Chdir(oldPath)
#undef FLTK_C_LIBNAME
end sub
Code: Select all
#ifndef __FLTK_OOP_BI__
#define __FLTK_OOP_BI__
dim shared as any ptr hFltkCLib
sub FLTK_OOP_RuntimeUnload destructor
if hFltkCLib then DyLibFree(hFltkCLib) : hFltkCLib = 0
end sub
sub FLTK_OOP_RuntimeLoad constructor
#if defined(__FB_DARWIN__) or defined(__FB_DOS__)
#error 666: Target host must be a Windows or Linux PC or ARM6 device !
#else
#ifndef __FB_64BIT__
#ifndef __FB_ARM__
#ifdef __FB_WIN32__
#define FLTK_C_LIBNAME "fltk-c-1.3.3-32.dll"
#else
#define FLTK_C_LIBNAME "fltk-c-1.3.3-32"
#endif
#else
#define FLTK_C_LIBNAME "fltk-c-1.3.3-32-arm"
#endif
#else
#ifdef __FB_WIN32__
#define FLTK_C_LIBNAME "fltk-c-1.3.3-64.dll"
#else
#define FLTK_C_LIBNAME "fltk-c-1.3.3-64"
#endif
#endif
#endif
if hFltkCLib then exit sub
var oldPath = CurDir()
Chdir(ExePath())
hFltkCLib = DyLibLoad(FLTK_C_LIBNAME)
if hFltkCLib=0 then
print "fatal error: " & FLTK_C_LIBNAME & " not loaded !"
beep : sleep : end 1
else
print "loaded " & FLTK_C_LIBNAME & " successful"
end if
Chdir(oldPath)
#undef FLTK_C_LIBNAME
end sub
#endif ' __FLTK_OOP_BI__