Debugging D DLL from C# app with C linkage for native Unity 5 plugin

Thalamus via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Mar 29 16:41:28 PDT 2016


Apologies if this has been discussed before, but I wasn't able to 
find anything similar on the forums or web. I can't seem to 
figure out how to debug a D DLL from a C# EXE. (My actual purpose 
here is to use D to build native plugins for Unity 5, but Unity 
and Mono aren't necessary to repro the problem I'm running into.)

The D DLL and C# are both built as 64-bit. (C# is not set to 
AnyCPU). Using VS 2015 and Visual D, I can drive the D DLL from 
the C# EXE without any problems, but the debugger doesn't load 
the D DLL symbols. The DLL and PDB are in the same folder as the 
C# EXE. Everything behaves the same if I link to the DLL 
statically using P/Invoke or dynamically using LoadLibrary.

Everything from the D DLL is exposed as extern(C), listed in the 
.def, etc. When I drive the DLL from a D EXE, I can break into 
the debugger easily, whether I attach at launch or attach to the 
process when it's already running.

I'm building the DLL using:

dmd <obj files omitted for brevity> dllmain.d dll.def -w -wi -g 
-map -ofLogic.dll <res and lib files omitted for brevity> -m64 
-debug -shared

Anyone know what I should try next? Am I missing something 
simple? :)

thanks!
Thalamus




More information about the Digitalmars-d-learn mailing list