How to use a function without their sources
    Johannes Pfau 
    nospam at example.com
       
    Fri Jan 18 10:19:07 PST 2013
    
    
  
Am Fri, 18 Jan 2013 18:47:41 +0100
schrieb "nazriel" <spam at dzfl.pl>:
> lib.d:
> void foo() {
> 	printf("%s".ptr, "hi".ptr);	
> }
> 
> test.d:
> extern(C) void _D3lib3fooFZv();
> 
I think this is dangerous, there's no guarantee that extern(D) equals
extern(C).
> How to handle name 
> mangling?
> Maybe pragma(mangleOf, "") by Alex Petterson could help.
extern(D) + pragma(mangleOf) could work.
But it's probably simpler and safer to just write a .di file for that
function manually:
lib.di:
module lib;
void foo();
    
    
More information about the Digitalmars-d-learn
mailing list