Re: Calling D function from C

2010-10-18 Thread Emil Madsen
Hopefully one could use printf, and tbh I dont like the hole garbage collector thingy :) 2010/10/12 Denis Koroskin <[email protected]> > On Tue, 12 Oct 2010 11:46:39 +0400, Emil Madsen wrote: > > wouldn't compiling, without garbage collector help too? >> >> 2010/10/12 Denis Koroskin <2kor...@gm

Re: Calling D function from C

2010-10-12 Thread Denis Koroskin
On Tue, 12 Oct 2010 11:46:39 +0400, Emil Madsen wrote: wouldn't compiling, without garbage collector help too? 2010/10/12 Denis Koroskin <[email protected]> On Tue, 12 Oct 2010 08:10:31 +0400, Daniel Worthington < [email protected]> wrote: Linking with the phobos lib got it to c

Re: Calling D function from C

2010-10-12 Thread Emil Madsen
wouldn't compiling, without garbage collector help too? 2010/10/12 Denis Koroskin <[email protected]> > On Tue, 12 Oct 2010 08:10:31 +0400, Daniel Worthington < > [email protected]> wrote: > > Linking with the phobos lib got it to compile, but I get a Bus Error when >> running: EXC_BA

Re: Calling D function from C

2010-10-12 Thread Denis Koroskin
On Tue, 12 Oct 2010 08:10:31 +0400, Daniel Worthington wrote: Linking with the phobos lib got it to compile, but I get a Bus Error when running: EXC_BAD_ACCESS (SIGBUS). Playing with the code a bit and looking at the crash reports, it looks like this happens whenever the D code tries to

Re: Calling D function from C

2010-10-11 Thread Daniel Worthington
Linking with the phobos lib got it to compile, but I get a Bus Error when running: EXC_BAD_ACCESS (SIGBUS). Playing with the code a bit and looking at the crash reports, it looks like this happens whenever the D code tries to allocate memory. Do you think this is an issue of using dmd and gcc toge

Re: Calling D function from C

2010-10-11 Thread bearophile
Denis Koroskin: > You need to link with phobos.lib (because this is where writeln is defined > and implemented). And maybe use dmc instead of gcc if the compilation is done on Windows. Bye, bearophile

Re: Calling D function from C

2010-10-11 Thread Denis Koroskin
On Tue, 12 Oct 2010 04:32:28 +0400, Daniel Worthington wrote: I'm trying to set up a project where I can call D functions from C code. Based on the documentation ( http://www.digitalmars.com/d/2.0/interfaceToC.html) it looks like I should be able to do the following: dee.d: - - - - - - -

Calling D function from C

2010-10-11 Thread Daniel Worthington
I'm trying to set up a project where I can call D functions from C code. Based on the documentation ( http://www.digitalmars.com/d/2.0/interfaceToC.html) it looks like I should be able to do the following: dee.d: - - - - - - - - import std.stdio; extern(C) { void sayHelloFromD() {