How do you use C based libs with D?

Alex Makhotin alex at bitprox.com
Fri Jun 11 13:30:04 PDT 2010


Robert M. Münch wrote:
> Hi, this is a bit related to my post regarding MingW compatibility.
> 
> As D uses Optilink (AFAIU) this implies that all C based code needs to 
> be compiled with DMC?
> 
> Not that I don't like DMC (I like it a lot) but I always had problems 
> (or it requires a bunch of work) to get open-source projects compileable 
> with it.
> 
> How do you deal with this?
> 

Produce static libraries in mingw as usual(no need to recompile with DMC 
or other compiler).
Produce shared library from these static libraries with mingw by linking 
all of them in one DLL.
Apply implib tool on obtained DLL.
Link obtained import library with the target.
Place the DLL in the exact private folder where your executable resides 
to avoid DLL hell.


-- 
Alex Makhotin,
the founder of BITPROX,
http://bitprox.com


More information about the Digitalmars-d mailing list