It seems pretty obvious the problem is with name mangling. But how to fix it?

------------------------------------------------------------------
module file;
extern(D) export
{
    int addOne(int i) { return (i + 1); }
}
------------------------------------------------------------------
module patron;
import file;    
void main()
{
    import std.stdio;
    int n = 1;
    writeln("mangled name of addOne is ", addOne.mangleof);
    numb = addOne(numb);
}
------------------------------------------------------------------
ldc2 -m64 -c file.d
ldc2 -m64 -c patron.d

ldc2 -m64 -shared file.obj -ofloadTime.dll
   Creating library loadTime.lib and object loadTime.exp

Both dumpbin /exports loadTime.lib and dumpbin /exports loadTime.dll
shows:  _D4file6addOneFiZi                              
                                
ldc2 patron.obj loadTime.lib

patron.exe
mangled name of addOne is _D6patron6addOneFiZi

// and library function is never called. Does not abend though???

-------------------------------------------------------------------

So the library function is named _D4file6addOneFiZi while the user wants to call _D6patron6addOneFiZi

So which name is "correct" and how do I get them to agree with each other?


                

Reply via email to