Thread overview | ||||||
---|---|---|---|---|---|---|
|
August 07, 2009 calling from C into D | ||||
---|---|---|---|---|
| ||||
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 |
August 07, 2009 Re: calling from C into D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Aaron Watters | 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 Watters
>
you need to create the header files by hand but you can call from C code to D functions that are extern(C).
|
August 07, 2009 Re: calling from C into D | ||||
---|---|---|---|---|
| ||||
Posted in reply to BCS | BCS wrote: > 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 Watters >> > > you need to create the header files by hand but you can call from C code to D functions that are extern(C). > > 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. |
August 07, 2009 Re: calling from C into D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Aaron Watters | 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 Watters A little hidden right now http://www.prowiki.org/wiki4d/wiki.cgi?DcalledFromC |
Copyright © 1999-2021 by the D Language Foundation