How to use a function without their sources
Jordi Sayol
g.sayol at yahoo.es
Fri Jan 18 10:21:04 PST 2013
Al 18/01/13 18:47, En/na nazriel ha escrit:
> 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.
>
Thanks!
Why it works with "extern(C)", but not works with "extern(D)"?
--
Jordi Sayol
More information about the Digitalmars-d-learn
mailing list