www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - How to link phobos funcs w/o full library?

reply Newbie <Newbie_member pathlink.com> writes:
I have my own library, say BestPrintfLib. :) It's windows executable so I call
manually gc_init(), _moduleCtor() and so on. And I have my own "printf" function
which of course conflicts with existing one in phobos. I _MUST_NOT_ rename
function, this is requirement. Question: Can I link to my project only USED
standard functions? Or may be there is way to create windows program with
garbage collector but w/o using phobos?
Sep 15 2005
parent reply Sean Kelly <sean f4.ca> writes:
In article <dgc07u$193q$1 digitaldaemon.com>, Newbie says...
I have my own library, say BestPrintfLib. :) It's windows executable so I call
manually gc_init(), _moduleCtor() and so on. And I have my own "printf" function
which of course conflicts with existing one in phobos. I _MUST_NOT_ rename
function, this is requirement. Question: Can I link to my project only USED
standard functions? Or may be there is way to create windows program with
garbage collector but w/o using phobos?

You will have to the portions of Phobos that conflict with your code. Alternately, you should be able to use Ares: http://www.dsource.org/projects/ares/ Sean
Sep 15 2005
next sibling parent reply "Charles" <noone nowhere.com> writes:
I'd like to use Ares, but I'm still unsure how to use it .  Do I still need
phobos for std.string / std.math functions etc ?  What is library_spec
describing , changes to phobos' types ?  Some examples and maybe a tutorial
would go a long way :).

Charlie


"Sean Kelly" <sean f4.ca> wrote in message
news:dgc7c8$1gug$1 digitaldaemon.com...
 In article <dgc07u$193q$1 digitaldaemon.com>, Newbie says...
I have my own library, say BestPrintfLib. :) It's windows executable so I


manually gc_init(), _moduleCtor() and so on. And I have my own "printf"


which of course conflicts with existing one in phobos. I _MUST_NOT_


function, this is requirement. Question: Can I link to my project only


standard functions? Or may be there is way to create windows program with
garbage collector but w/o using phobos?

You will have to the portions of Phobos that conflict with your code. Alternately, you should be able to use Ares: http://www.dsource.org/projects/ares/ Sean

Sep 15 2005
parent reply Sean Kelly <sean f4.ca> writes:
In article <dgcg55$1rtk$1 digitaldaemon.com>, Charles says...
I'd like to use Ares, but I'm still unsure how to use it .  Do I still need
phobos for std.string / std.math functions etc ?  What is library_spec
describing , changes to phobos' types ?  Some examples and maybe a tutorial
would go a long way :).

Sorry about that :-) At the moment, Ares contains very little beyond but what is essential to run a D application. So anything you use from the 'std' portion of Phobos is likely not present. Once I get the next release out I'll work on a short tutorial of how to use Ares. And ignore the library_spec file for now--it's nearly empty and long out of date. I'm waiting for DMD's built-in code documenter before I do any more on that end. Sean
Sep 15 2005
parent Sean Kelly <sean f4.ca> writes:
In article <dgcig4$1ukf$1 digitaldaemon.com>, Sean Kelly says...
In article <dgcg55$1rtk$1 digitaldaemon.com>, Charles says...
I'd like to use Ares, but I'm still unsure how to use it .  Do I still need
phobos for std.string / std.math functions etc ?  What is library_spec
describing , changes to phobos' types ?  Some examples and maybe a tutorial
would go a long way :).

Sorry about that :-) At the moment, Ares contains very little beyond but what is essential to run a D application. So anything you use from the 'std' portion of Phobos is likely not present. Once I get the next release out I'll work on a short tutorial of how to use Ares.

I've fleshed out the readme in this release. It now contains a bit more information on what everything is and how to install and build against the Ares library. If there's any more information you think would be useful, please let me know. Documentation isn't my strong suit :) Sean
Sep 16 2005
prev sibling parent reply Newbie <Newbie_member pathlink.com> writes:
You will have to the portions of Phobos that conflict with your code.

Sorry, Sean, I'm not so good in English. What you mean "portions"? In my code I import nothing from Phobos except init/finish functions (I import those manually). But when I link my OBJ I get error about conflict. What I need to do?
Sep 16 2005
parent reply Sean Kelly <sean f4.ca> writes:
In article <dgegm3$o8s$1 digitaldaemon.com>, Newbie says...
You will have to the portions of Phobos that conflict with your code.

Sorry, Sean, I'm not so good in English. What you mean "portions"? In my code I import nothing from Phobos except init/finish functions (I import those manually). But when I link my OBJ I get error about conflict. What I need to do?

I left out a word by mistake. I meant "remove the portions of Phobos that conflict." Delete references to those objects files in win32.mak or linux.mak. Sean
Sep 16 2005
parent reply adv. newbie <adv._member pathlink.com> writes:
Sorry, Sean, I'm not so good in English. What you mean "portions"?
In my code I import nothing from Phobos except init/finish functions (I import
those manually). But when I link my OBJ I get error about conflict.


I left out a word by mistake.  I meant "remove the portions of Phobos that
conflict."  Delete references to those objects files in win32.mak or linux.mak.

OK, as I understood I need to RECOMPILE Phobos w/o object files, which conflicts with my own. Right? Question 2: Is there some priority mechanism to solve "duplicates" conflict? For example, first resolve all symbols thru LIB1, and all unreferenced symbols thru LIB2?
Sep 19 2005
parent Sean Kelly <sean f4.ca> writes:
In article <dgm5ek$1dhe$1 digitaldaemon.com>, adv. newbie says...
Sorry, Sean, I'm not so good in English. What you mean "portions"?
In my code I import nothing from Phobos except init/finish functions (I import
those manually). But when I link my OBJ I get error about conflict.


I left out a word by mistake.  I meant "remove the portions of Phobos that
conflict."  Delete references to those objects files in win32.mak or linux.mak.

OK, as I understood I need to RECOMPILE Phobos w/o object files, which conflicts with my own. Right?

Right.
Question 2: Is there some priority mechanism to solve "duplicates" conflict? For
example, first resolve all symbols thru LIB1, and all unreferenced symbols thru
LIB2?

Not that I'm aware of, but such a mechanism wouldn't work with Phobos anyway, as Phobos is implicitly linked to all D programs by DMD. If such a mechanism were in place, it would always find the symbols from Phobos before it searched your library. Sean
Sep 19 2005