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@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.

-- 
Ewald

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to