On Mon, 12 Mar 2012 10:53:09 -0400, Chris W. <[email protected]> wrote:
I have a problem when calling D functions from C. While I can perform simple arithmetic operations (i.e. the calculation is performed in D and returned to C), I experience problems when trying to perform string/char operations or call functions from the D standard library (e.g. writefln()). The usual error message I get is either "Bus error" or "Segmentation fault". I haven't been able to find the reason for this. The programs compile and link, however, when run, they terminate with "Bus error" whenever a D function is performed within the D code, e.g. something like char[] s2 = s.dup; (s is a char* passed from C). Any hint or help would be appreciated. I am using Mac OS X, 10.6.7
If C is running your application startup, you must initialize D's runtime from your C main routine.
-Steve
