Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: Greatwolf on August 02, 2010, 07:34:36 am

Title: How to prepend extra char to $link_resobjects macro?
Post by: Greatwolf on August 02, 2010, 07:34:36 am
The linker I'm using needs to have each compiled resource *.res file prepended with a '-l' for it to work properly. So say my project has 2 or more resource files for example, foo.res and bar.res, it needs to be passed to the linker like so:

Code
bcc32 -lfoo.res -lbar.res

How can I setup C::B to do this? Using latest nightly build btw.

Thanks
Title: Re: How to prepend extra char to $link_resobjects macro?
Post by: stahta01 on August 02, 2010, 05:55:02 pm
Did you try the project other linker settings?

Tim S.
Title: Re: How to prepend extra char to $link_resobjects macro?
Post by: Greatwolf on August 02, 2010, 10:06:24 pm
you mean adding it under the other linker options? yes I could certainly do that but then it has to be done for each and every project configuration. You could even argue every single obj file and parameter could be passed to the linker in this fashion but it's not really convenient.

I looked under global compiler settings->other settings->advanced options. I tried adding that -l switch before the $link_resobjects, but there are two problems doing it this way. First, '-l' isn't prepended before every res file -- only the first res file on the list. Second issue is what if my project doesn't have a resource file? That -l will get passed to the linker anyway and I have an extra unnecessary argument during the link process.
Title: Re: How to prepend extra char to $link_resobjects macro?
Post by: stahta01 on August 02, 2010, 11:23:15 pm
Adding it once per project does not seem to be that much work to me.
No idea why you think it is so hard to do.
Just doing manually or edit the source code of Code::Blocks.

You might see if using the borland cfg files has a way to do this.

Edit: I see you tried using Adv Compiler Options. And that failed, I have nothing else to suggest.

Tim S.
Title: Re: How to prepend extra char to $link_resobjects macro?
Post by: Greatwolf on August 03, 2010, 01:04:07 am
Under the Link object files to static lib I see the following  command macro:

Code
$lib_linker /C $static_output $+-link_objects,$def_output

and it gives the correct output if I was building a static library. Namely the command executed by C::B would look something like this:

Code
tlib /C mytestlib.lib +object1.obj +object2.obj ... +objectn.obj

which is the correct usage. But how is this command able to do this? If I try to use $+-link_objects under the l link obj to executable, that part is just treated as a literal instead of a macro variable. Can anyone shed some light on this?

Thanks