On 21.02.2012 04:08, torhu wrote:
On 20.02.2012 22:36, Benjamin Thaut wrote:
2) Will dmd support exporting/importing data symbols from dlls? I know
there is a patch that does the data symbol address patching from the
runtime but thats a feature that should be supported by the compiler
directly in my eyes.
Importing data symbols works just fine both in DMD and GDC. At least it
did a couple of years ago. Can't remember if I've tried exporting, but I
wouldn't be surprised if it worked.
You don't need to do anything special to get it working, just use
declare the data as 'export extern extern (C)' in your D code. For D2
prefix that with '__gshared'. Not very elegent, but it does work.
I should mention that 'export' also works for importing. It does the
job of both '__declspec(dllimport)' and '__declspec(dllexport)'.