Am I doing it wrong or is this a bug ?

Ezneh petitv.isat at gmail.com
Thu Aug 12 07:08:12 PDT 2010


Ezneh Wrote:

> Richard Webb Wrote:
> 
> > Is returning a D string to a non-D language going to cause problems?
> 
> Hmm it seems that returning an int works but returning string / char types doesn't work ...
> 
> 
> Anyone knows why ?


PS : "works" is kinda like "doesn't return an exception" but there's still something wrong with the DLL.


//mydll.d
module mydll;
import std.stdio;

	extern (C) export int dllprint(int something) { return something^^something; }

//test.d
import mydll;
import std.stdio;

int main(string args[])
{
   writeln(mydll.dllprint(2));
   return 0;
}

//Fine prints 4

But using it in .Net environment it prints "0" ...


More information about the Digitalmars-d mailing list