View mode: basic / threaded / horizontal-split · Log in · Help
May 17, 2008
Runtine Library Loading?
One thing that would be very handy for a project I'm about to undertake would be runtine libray loading. In C, I could use dlopen() and its related functions to load a DLL and call functions in it. In C++, it was... sketchy and I never really used it in much detail. Can D do this?
This would be a linux only project, and from what I've read, this sort of thing tends to work more on linux. I could stick to C functions if necessary, but that would give little benefit from just using straight C.
The structure of the project would just be an executable that would load up libraries and call functions in them. All classes used in arguments between libraries would be defined in the executable. The libraries would follow a standardized interface.
May 17, 2008
Re: Runtine Library Loading?
Andrew Wiley wrote:

> One thing that would be very handy for a project I'm about to undertake
> would be runtine libray loading. In C, I could use dlopen() and its
> related functions to load a DLL and call functions in it. In C++, it
> was... sketchy and I never really used it in much detail. Can D do this?
> This would be a linux only project, and from what I've read, this sort of
> thing tends to work more on linux. I could stick to C functions if
> necessary, but that would give little benefit from just using straight C.
> The structure of the project would just be an executable that would load
> up libraries and call functions in them. All classes used in arguments
> between libraries would be defined in the executable. The libraries would
> follow a standardized interface.

Tango has tango.sys.SharedLibrary for this.

-- 
Lars Ivar Igesund
blog at http://larsivi.net
DSource, #d.tango & #D: larsivi
Dancing the Tango
May 18, 2008
Re: Runtine Library Loading?
"Andrew Wiley" <arew264@gmail.com> wrote in message 
news:g0n82n$nsg$1@digitalmars.com...
> One thing that would be very handy for a project I'm about to undertake 
> would be runtine libray loading. In C, I could use dlopen() and its 
> related functions to load a DLL and call functions in it. In C++, it 
> was... sketchy and I never really used it in much detail. Can D do this?
> This would be a linux only project, and from what I've read, this sort of 
> thing tends to work more on linux. I could stick to C functions if 
> necessary, but that would give little benefit from just using straight C.
> The structure of the project would just be an executable that would load 
> up libraries and call functions in them. All classes used in arguments 
> between libraries would be defined in the executable. The libraries would 
> follow a standardized interface.

If it's Linux-only, you've saved yourself a ton of trouble.  I've played 
around with SOs and D, and they seem to work great.  Classes, functions, 
exception handling etc. all seem to work fine when put in an SO.
May 18, 2008
Re: Runtine Library Loading?
Jarrett Billingsley schrieb:
> If it's Linux-only, you've saved yourself a ton of trouble.  I've played 
> around with SOs and D, and they seem to work great.  Classes, functions, 
> exception handling etc. all seem to work fine when put in an SO. 
> 
> 

With what compiler did you test that? DMD/GDC?
May 18, 2008
Re: Runtine Library Loading?
"Frank Benoit" <keinfarbton@googlemail.com> wrote in message 
news:g0pomm$2320$1@digitalmars.com...
> Jarrett Billingsley schrieb:
>> If it's Linux-only, you've saved yourself a ton of trouble.  I've played 
>> around with SOs and D, and they seem to work great.  Classes, functions, 
>> exception handling etc. all seem to work fine when put in an SO.
>
> With what compiler did you test that? DMD/GDC?

GDC.  I've heard there are issues with DMD and SOs.  I don't use DMD on 
Linux because, well, I've never gotten it to work correctly.
Top | Discussion index | About this forum | D home