how to use dll

Daniel Keep daniel.keep.lists at gmail.com
Wed Jan 21 22:21:23 PST 2009



reimi gibbons wrote:
> Hi all,
> 
> I'm currently developing a software with D and Tango. I don't have much knowledge on DLL, but i do know when linking to static lib you need a .h header file, but do i need .h for linking with DLL as well?
> 
> also can anybody please provide a quick and small example to link with DLL.
> 
> *im trying to link my software with ICU lib, since mango seems outdated.
> 
> Thanks,
> Reimi.

You need two things to link to a DLL:

1. You need the interface of the DLL.  In C/C++, this is provided by .h
files; in D, this is simply provided by a D module.

2. Loader code.

You can either roll your own, or generate the above two.  You can use
htod (it's somewhere on the official D pages) which tries to convert a C
header file into a D import module.

As for the loader code, you can either write a dynamic loader, or just
use implib on the DLL to generate one (I think; it's been a while since
I've had to roll one.)

If I can remember more specific details, I'll post again, but that's the
basic gist of it.

  -- Daniel


More information about the Digitalmars-d-learn mailing list