How to use a function without their sources

nazriel spam at dzfl.pl
Fri Jan 18 09:47:41 PST 2013


On Friday, 18 January 2013 at 17:02:51 UTC, Jordi Sayol wrote:
> Is there a way to use a function from a static D library 
> without importing their D sources nor their DI interface?

lib.d:

extern(C) void printf(const char*, ...);

void foo() {
	printf("%s".ptr, "hi".ptr);	
}

test.d:

extern(C) void _D3lib3fooFZv();

void main() {
	_D3lib3fooFZv();
}

Hehe.

Now, to be honest that is a good question. How to handle name 
mangling?
Maybe pragma(mangleOf, "") by Alex Petterson could help.


More information about the Digitalmars-d-learn mailing list