Creating A D DLL For Use By VB

starkweatherr at mchsi.com starkweatherr at mchsi.com
Sun Mar 19 11:55:18 PST 2006


No joy. Here's the code.

//MyDLL.d
extern (Windows) int addInt(int int1, int int2);

//MyDLL2.d
module mydll;
extern (Windows) int addInt(int int1, int int2)
{ 
return (int1 + int2);
}

;MyDLL.def
LIBRARY "mydll.dll"
EXETYPE NT
SUBSYSTEM WINDOWS
CODE SHARED EXECUTE
DATA WRITE

@echo off
REM Build.bat
E:\DigitalMars\dmd\bin\dmd -ofmydll.dll mydll2.d dll.d mydll.def
E:\DigitalMars\dmd\bin\implib /system mydll.lib mydll.dll
E:\DigitalMars\dmd\bin\dmd test.d mydll.lib

I got two errors. Implib says no functions are exported and
OptLink says Undefined Symbol: intAdd at 8

Am I supposed to put 'export extern (Windows) ' instead of just 'extern
(Windows)'?





More information about the Digitalmars-d-learn mailing list