digitalmars.D - calling from C into D
- Aaron Watters (9/9) Aug 07 2009 Ok, next question: If I wanted to run some D stuff under
- BCS (3/13) Aug 07 2009 you need to create the header files by hand but you can call from C code...
- Chad J (9/26) Aug 07 2009 You may also want to initialize the D runtime.
- Jesse Phillips (3/14) Aug 07 2009 A little hidden right now
Ok, next question: If I wanted to run some D stuff under the Apache web server in embedded mode I would have to be able to write some C code which calls into D code. This topic is not discussed in the docs that I can find. Is it possible to call from C into D (to embedded D code into a larger process written in C)? You can't do this in java and this is one of the reasons I always was averse to java from the beginning. Thanks again, -- Aaron Watters
Aug 07 2009
Reply to Aaron,Ok, next question: If I wanted to run some D stuff under the Apache web server in embedded mode I would have to be able to write some C code which calls into D code. This topic is not discussed in the docs that I can find. Is it possible to call from C into D (to embedded D code into a larger process written in C)? You can't do this in java and this is one of the reasons I always was averse to java from the beginning. Thanks again, -- Aaron Wattersyou need to create the header files by hand but you can call from C code to D functions that are extern(C).
Aug 07 2009
BCS wrote:Reply to Aaron,You may also want to initialize the D runtime. An example of that for D2 can be found here: http://www.digitalmars.com/d/2.0/windows.html or for D1: http://www.digitalmars.com/d/1.0/windows.html Even though you aren't writing a Windows application, you should probably write some kind of "extern(C) init() {...}" function that your Apache code would call and thus set up the runtime.Ok, next question: If I wanted to run some D stuff under the Apache web server in embedded mode I would have to be able to write some C code which calls into D code. This topic is not discussed in the docs that I can find. Is it possible to call from C into D (to embedded D code into a larger process written in C)? You can't do this in java and this is one of the reasons I always was averse to java from the beginning. Thanks again, -- Aaron Wattersyou need to create the header files by hand but you can call from C code to D functions that are extern(C).
Aug 07 2009
Aaron Watters Wrote:Ok, next question: If I wanted to run some D stuff under the Apache web server in embedded mode I would have to be able to write some C code which calls into D code. This topic is not discussed in the docs that I can find. Is it possible to call from C into D (to embedded D code into a larger process written in C)? You can't do this in java and this is one of the reasons I always was averse to java from the beginning. Thanks again, -- Aaron WattersA little hidden right now http://www.prowiki.org/wiki4d/wiki.cgi?DcalledFromC
Aug 07 2009