www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - D compiler embedding

reply Peloto <peloto peloto.com> writes:
Can I embed the D compiler into my application? For example:

Dcompiler c;
Dcompiler::result *r = c.compile("mySource.d");
fstream f("result.bin");
f.write(r->GetBuffer(),r->GetNBytes());

And other doubt... where's the Solaris port for the D compiler? I see only
Windows, linux, freeBSD and MacOSX.

thx.
May 03 2009
next sibling parent "Simen Kjaeraas" <simen.kjaras gmail.com> writes:
Peloto wrote:

 Can I embed the D compiler into my application? For example:

 Dcompiler c;
 Dcompiler::result *r = c.compile("mySource.d");
 fstream f("result.bin");
 f.write(r->GetBuffer(),r->GetNBytes());

Short answer: No. Long answer: Several people have been asking for this, and there has been at least one implementation. Burton Radons wrote http://members.shaw.ca/burton-radons/The%20Joy%20and%20Gibbering%20Terror%20of%20Custom-Loading 20Executables.html, which I have not myself tried, but it seems like it should do what you ask for. -- Simen
May 03 2009
prev sibling parent reply Robert Fraser <fraserofthenight gmail.com> writes:
Peloto wrote:
 And other doubt... where's the Solaris port for the D compiler? I see only
Windows, linux, freeBSD and MacOSX.

http://www.dsource.org/projects/ldc
May 03 2009
parent Jason House <jason.james.house gmail.com> writes:
Robert Fraser Wrote:

 Peloto wrote:
 And other doubt... where's the Solaris port for the D compiler? I see only
Windows, linux, freeBSD and MacOSX.

http://www.dsource.org/projects/ldc

The Phobos changelog implies the next D1 release will have Dolaris support. D2 support is on hold due to other drastic changes. Regardless, LDC is a good recommendation; it supports a lot of platforms dmd does not. I'm still hoping for 64 bit support in dmd.
May 04 2009