torhu Wrote: > On 06.05.2010 16:06, Nrgyzer wrote: > > Thanks, but doesn't work :( > > > > My files contain: > > > > mydll.d: > > > > module mydll; > > export extern int i; > > > > mydll2.d: > > > > module mydll; > > export int i = 7; > > > > test.d: > > > > import mydll; > > import std.stdio; > > > > void main() { > > writefln(i); > > } > > > > I can compile the dll, but when I compile test.d, I get the following > > error: "Error 42: Symbol Undefined _D5mydll1ii" > > It seems that export doesn't work for data, only functions. If you > build with -map, you'll see that i is not exported. I got it working by > using this .def file: > > LIBRARY "mydll.dll" > EXETYPE NT > EXPORTS > D5mydll1ii > > > Then create the import lib with: > implib /s mydll.lib mydll.dll > > /s adds the underscores. > > > If you use extern (C) the symbols will be a lot simpler to read and > write, though. Look at the .map file to see what the actual symbols are.
Thanks - works :)