[fpc-pascal] Mangle name in fpc-FreeBSD ?

Ewald ewald at yellowcouch.org
Sat Mar 19 20:10:12 CET 2016

On 03/19/2016 07:49 PM, fredvs wrote:
> Hello Marc.
> Huh, I have a dummy question...
> How do you use dlopen(), dlsym() and dlerror() ?
> On console, with ->
> fred at freebsd> dlopen('/root/mylib.so')
> Result = "Illegal command name..."
>> call dlerror() after the failing dlsym(). It should tell _why_ the call
>> failed. 
> Re-huh..., it should be a great plus if a dlerror() was implemented in fpc
> too.
> But maybe I am missing something, maybe dlopen(), dlsym() and dlerror() can
> be done by pascal code (and not via console, like I try).
dlopen, dlsym and dlerror are *functions*, not console commands. Well, I
never tried the latter, but it appears they are not on your system ;-)

Now, I don't know where exactly these functions are declared (in which
unit, that is), but for debugging purposes, just add

    Function dlopen(filename: PChar; flags: cint): Pointer; cdecl; external;
    Function dlclose(handle: Pointer): cint; cdecl; external;
    Function dlsym(handle: Pointer; Name: PChar): Pointer; cdecl; external;
    Function dlerror: PChar; cdecl; external;

Somewhere in your code before you call them.


More information about the fpc-pascal mailing list