Mixing D and C - Windows

Mike Parker aldacron at gmail.com
Mon Jan 2 19:46:51 PST 2012


On 1/3/2012 12:43 PM, Mike Parker wrote:
> On 1/3/2012 10:02 AM, DNewbie wrote:
>> Thank you both.
>>
>> I've created a D DLL [http://dlang.org/dll.html], then I've loaded it
>> from a C program [compiled with dmc].
>> However, I'd want to be able to call it from a C program compiled with
>> MSVC, and I got a link error - unresolved external symbol [link
>> testdll.obj /implib:mydll.lib /out:testdll-msvc.exe]. The LoadLibrary
>> works with both DMC/MSVC, but it isn't 'handy'.?.
>>
>>
>
> That's because the object file formats used by DMC and MSVC are
> different. DMC outputs OMF, MSCV uses COFF. If you download objconv[1],
> you can use it to convert between the two formats. Something like
>
> objconv -fcoff -nu mydll.lib mydll_mscv.lib
>
> should do the trick.
>
> [1] http://www.agner.org/optimize/objconv.zip

Or did you do that already? I just realized that would likely give a 
corrupt file error, not an unresolved symbol.


More information about the Digitalmars-d-learn mailing list