using d dll/lib with msvc program

crashtua crashtua at gmail.com
Mon May 14 10:59:45 PDT 2012


But it is something strange, one function need '_' and another 
dont:(
In D dll i have:

extern (C) int function() f;
alias typeof(f) myfunc;

export extern (C) int retten()
{
	return 10;
}
export extern (C) void setf(myfunc ff)
{
	f=ff;
}
export extern (C) int ret()
{
	return f();
}

In C code:

int(*retten)() = (int (*)())GetProcAddress(dLib,"_retten");
int(*ret)() = (int (*)())GetProcAddress(dLib,"ret");
void(*setf)(int(*)()) = (void 
(*)(int(*)()))GetProcAddress(dLib,"setf");

Why so strange?


More information about the Digitalmars-d mailing list