February 07, 2007
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?

I know I can put the dll in the system path and work on it from there, but doing so ruins all portability I'm striving for, any pointers?
February 07, 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.
February 07, 2007
Mike Parker wrote:
> 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.

I've ran implib.exe against it and generated a my.lib file which I've put into the same directory as my.dll, and when I use:
 pragma (lib, r"b/c/d/my.lib");
I get an alert box stating "This application has failed to start because my.dll was not found"

Sorry, that was in my draft.. didn't make it into the post though


February 07, 2007
Robby wrote:
> Mike Parker wrote:
> 
>> 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.
> 
> 
> I've ran implib.exe against it and generated a my.lib file which I've put into the same directory as my.dll, and when I use:
>  pragma (lib, r"b/c/d/my.lib");
> I get an alert box stating "This application has failed to start because my.dll was not found"
> 
> Sorry, that was in my draft.. didn't make it into the post though
> 
> 

Windows expects to find the DLL in the same directory as the .exe, or in your Windows\system32 directory.

-- 
Kirk McDonald
Pyd: Wrapping Python with D
http://pyd.dsource.org
February 07, 2007
On Wed, 07 Feb 2007 00:43:00 -0800, Kirk McDonald wrote:

> Robby wrote:
>> Mike Parker wrote:
>> 
>>> 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.
>> 
>> 
>> I've ran implib.exe against it and generated a my.lib file which I've
>> put into the same directory as my.dll, and when I use:
>>  pragma (lib, r"b/c/d/my.lib");
>> I get an alert box stating "This application has failed to start because
>> my.dll was not found"
>> 
>> Sorry, that was in my draft.. didn't make it into the post though
>> 
>> 
> 
> Windows expects to find the DLL in the same directory as the .exe, or in your Windows\system32 directory.
>


I believe windows will also look in a executable path set in the PATH environment.
February 08, 2007
On Wed, 7 Feb 2007 21:24:19 +0000 (UTC), John Reimer
<terminal.node@gmail.com> wrote:

>On Wed, 07 Feb 2007 00:43:00 -0800, Kirk McDonald wrote:
>
>> Robby wrote:
>>> Mike Parker wrote:
>>> 
>>>> 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.
>>> 
>>> 
>>> I've ran implib.exe against it and generated a my.lib file which I've
>>> put into the same directory as my.dll, and when I use:
>>>  pragma (lib, r"b/c/d/my.lib");
>>> I get an alert box stating "This application has failed to start because
>>> my.dll was not found"
>>> 
>>> Sorry, that was in my draft.. didn't make it into the post though
>>> 
>>> 
>> 
>> Windows expects to find the DLL in the same directory as the .exe, or in your Windows\system32 directory.
>>
>
>
>I believe windows will also look in a executable path set in the PATH environment.

And in the Windows and Windows\system directories
Top | Discussion index | About this forum | D home