www.digitalmars.com         C & C++   DMDScript  

D.gnu - Remove libphobos dependency

reply Vincent Richomme <forumer smartmobili.com> writes:
Hi,

I am interested in D language but libphobos library is far from being 
portable and development is too slow.
I would like to know how can I remove libphobos dependecy because from 
what I see now I cannot compile a simple example without it.




Thanks
Jul 12 2008
parent reply Lars Ivar Igesund <larsivar igesund.net> writes:
Vincent Richomme wrote:

 Hi,
 
 I am interested in D language but libphobos library is far from being
 portable and development is too slow.
 I would like to know how can I remove libphobos dependecy because from
 what I see now I cannot compile a simple example without it.
 
 
 
 
 Thanks
Look to Tango? http://www.dsource.org/projects/tango As for GDC specific, see the --nostdlib switch or something along those lines. -- Lars Ivar Igesund blog at http://larsivi.net DSource, #d.tango & #D: larsivi Dancing the Tango
Jul 12 2008
next sibling parent Vincent Richomme <forumer smartmobili.com> writes:
Lars Ivar Igesund a écrit :
 Vincent Richomme wrote:
 
 Hi,

 I am interested in D language but libphobos library is far from being
 portable and development is too slow.
 I would like to know how can I remove libphobos dependecy because from
 what I see now I cannot compile a simple example without it.




 Thanks
Look to Tango? http://www.dsource.org/projects/tango As for GDC specific, see the --nostdlib switch or something along those lines.
Sounds interesting buf in a first step I would like no lib. I just want to display a message box on a wince platform. There's something I don't understand with D language , I can see that on a sample given here http://www.digitalmars.com/d/2.0/index.html import std.stdio; void main(string[] args) { .... } but when I look ar D for win32 I can see this : import std.c.windows.windows; extern (C) void gc_init(); extern (C) void gc_term(); extern (C) void _minit(); extern (C) void _moduleCtor(); extern (C) void _moduleDtor(); extern (C) void _moduleUnitTests(); extern (Windows) int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { int result; gc_init(); // initialize garbage collector _minit(); // initialize module constructor table try { _moduleCtor(); // call module constructors _moduleUnitTests(); // run unit tests (optional) result = myWinMain(hInstance, hPrevInstance, lpCmdLine, nCmdShow); _moduleDtor(); // call module destructors } catch (Object o) // catch any uncaught exceptions { MessageBoxA(null, cast(char *)o.toString(), "Error", MB_OK | MB_ICONEXCLAMATION); result = 0; // failed } gc_term(); // run finalizers; terminate garbage collector return result; } int myWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { /* ... insert user code here ... */ } In this second example there are lots of code about garbage collection (gc_init, ...)while in the first sample there are not. Does it mean on windows we always have to call gc_init ? Is it specific to Windows platform , GDC compiler or libphobos lib ? Last question about auto keyword, does it mean variable is handled by garbage collector : foreach (argc, argv; args) { // Object Oriented Programming auto cl = new CmdLin(argc, argv); // Improved typesafe printf writeln(cl.argnum, cl.suffix, " arg: ", cl.argv); // Automatic or explicit memory management delete cl; } in the code below I don't understand why to declare auto if then it is destroyed manually ...
Jul 12 2008
prev sibling parent reply e-t172 <e-t172 akegroup.org> writes:
Lars Ivar Igesund a écrit :
 As for GDC specific, see the --nostdlib switch or something along those
 lines.
It's -nophoboslib, actually.
Jul 12 2008
parent reply Vincent Richomme <forumer smartmobili.com> writes:
e-t172 a écrit :
 Lars Ivar Igesund a écrit :
 As for GDC specific, see the --nostdlib switch or something along those
 lines.
It's -nophoboslib, actually.
In which file should I add this parameter ?
Jul 13 2008
parent reply Vincent Richomme <forumer smartmobili.com> writes:
Vincent Richomme a écrit :
 e-t172 a écrit :
 Lars Ivar Igesund a écrit :
 As for GDC specific, see the --nostdlib switch or something along those
 lines.
It's -nophoboslib, actually.
In which file should I add this parameter ?
Hum maybe you mean when calling gdc compiler.
Jul 13 2008
parent David Friedman <dvdfrdmn users.ess-eff.net> writes:
Vincent Richomme wrote:
 Vincent Richomme a écrit :
 e-t172 a écrit :
 Lars Ivar Igesund a écrit :
 As for GDC specific, see the --nostdlib switch or something along those
 lines.
It's -nophoboslib, actually.
In which file should I add this parameter ?
Hum maybe you mean when calling gdc compiler.
-nophoboslib in the link command is the way to go. This lets you link against libgcc without having the link libgphobos and the the system pthread libraries. If you are using the GNU linker, you can also reduce link dependencies by compiling with -ffunction-sections and -fdata-sections and then link with -Wl,-gc-sections.
Jul 14 2008