Basics of calling C from D

simendsjo via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jun 11 07:12:18 PDT 2014


On 06/11/2014 03:54 PM, Adam D. Ruppe wrote:
> 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.

I believe the correct answer should be "Buy my book!".


More information about the Digitalmars-d-learn mailing list