pragma, dlls, etc

Mike Parker aldacron71 at
Wed Feb 7 00:21:53 PST 2007

Robby wrote:
> I've spent the past couple of hours beating my head around this so I 
> thought I would see if I can get some help.
> Considering the following directory structure:
> a/
>   b/
>   compile.bat
>     c/
>       d/
>         my.dll
>       main.d
> compile.bat:
> dmd -run b/c/main.d  -I../b -I../b/c/d/
> pause
> in main.d I have
> pragma (lib, r"b/c/d/my.dll");
> and I get Not a valid library file
> Obviously there is, but is there something I'm missing?

You need to create an import library (my.lib) and link to that. DMD 
doesn't link directly to DLLs. In fact, most C and C++ compilers do not 
do this on Windows, either. MingW is the only one I know of that accepts 
DLLs on the command line in place of library archives.

More information about the Digitalmars-d-learn mailing list