Thread overview
Using MinGW DLL with DMD?
Aug 09, 2012
Jacob Carlborg
Aug 09, 2012
Adam D. Ruppe
Aug 09, 2012
Dejan Lekic
Aug 09, 2012
Jacob Carlborg
Aug 09, 2012
Dejan Lekic
Aug 09, 2012
dnewbie
August 09, 2012
Is it possible to link a DLL compiled for MinGW with DMD?

-- 
/Jacob Carlborg
August 09, 2012
On Thursday, 9 August 2012 at 13:43:18 UTC, Jacob Carlborg wrote:
> Is it possible to link a DLL compiled for MinGW with DMD?

Yeah, I've use dlls made in gcc with dmd. You need to run implib
over the dll to get a .lib and then it works pretty easily.

implib /s mydll.lib mydll.dll


implib can be found in the basic utilities package at digital
mars.

http://www.digitalmars.com/download/freecompiler.html
August 09, 2012
On Thursday, 9 August 2012 at 13:43:18 UTC, Jacob Carlborg wrote:
> Is it possible to link a DLL compiled for MinGW with DMD?

Yes, it is possible.

Long ago i have dealt with this almost on a daily basis (we used Borland C++ Builder on Windows in the former company I worked for).

The easiest method is to use DEF files to create the import library. If you do not have it, you can use some tool that will analyse the DLL, make the DEF file for you, and then you modify it to your needs, and then create the import library for your target toolchain.

This article explains everything you need to know: http://wyw.dcweb.cn/stdcall.htm

Regards
August 09, 2012
On Thursday, 9 August 2012 at 13:48:14 UTC, Adam D. Ruppe wrote:
> On Thursday, 9 August 2012 at 13:43:18 UTC, Jacob Carlborg wrote:
>> Is it possible to link a DLL compiled for MinGW with DMD?
>
> Yeah, I've use dlls made in gcc with dmd. You need to run implib
> over the dll to get a .lib and then it works pretty easily.
>
> implib /s mydll.lib mydll.dll
>
>
> implib can be found in the basic utilities package at digital
> mars.
>
> http://www.digitalmars.com/download/freecompiler.html

Yes, this works in most cases, but when it does not, then you have to use DEF files and modify/add symbols. It is not complicated, just time-consuming...
August 09, 2012
On 2012-08-09 15:48, Adam D. Ruppe wrote:

> Yeah, I've use dlls made in gcc with dmd. You need to run implib
> over the dll to get a .lib and then it works pretty easily.
>
> implib /s mydll.lib mydll.dll
>
>
> implib can be found in the basic utilities package at digital
> mars.
>
> http://www.digitalmars.com/download/freecompiler.html

Thanks, I'll give it a try.

-- 
/Jacob Carlborg
August 09, 2012
There's an example:
http://my.opera.com/run3/blog/2012/01/24/mixing-c-and-d-on-windows-part-1