Basics of calling C from D

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jun 11 06:54:09 PDT 2014


On Wednesday, 11 June 2014 at 13:52:09 UTC, belkin wrote:
> Question: How do I use it from D?

Write the prototype in your D file with extern(C):
extern(C) int factorial(int n);

then just call the function normally in D. Make sure you include 
all the C object files when you compile the D program too so it 
all links together.


More information about the Digitalmars-d-learn mailing list