Basics of calling C from D

belkin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jun 11 06:52:08 PDT 2014


Example: I have this C function that is compiled into a library

//File: factorial.h
int factorial(int n);


//File: factorial.c
#include "factorial.h"

int factorial(int n)
{
     if(n!=1)
      return n*factorial(n-1);
}

Question: How do I use it from D?


More information about the Digitalmars-d-learn mailing list