Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2012-11

problem with command line defines??

5 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

waldo kitty

on OS/2 eCS2 i have fpc 2.6.0 release installed... i've been working with a library and needed to create a define so that some code would be compiled that otherwise is not... since i have to compile from the command line with fpc, i compiled my project like this...

fpc -dOS2GCC testhttp

and it did compile with the defined code block... later, i wanted to test without that defined code block so i compiled again like this...

fpc testhttp

but the library wasn't recompiled... i had to manually remove the *.O and *.ppu files to get it recompiled without the defined code block...

why?

the time between compilation and testing attempts was less than one minute... would this have something to do with this problem?

Reply by email

Jonas Maebe
to waldo kitty
waldo kitty wrote 11 lines
on OS/2 eCS2 i have fpc 2.6.0 release installed... i've been working with a library and needed to create a define so that some code would be compiled that otherwise is not... since i have to compile from the command line with fpc, i compiled my project like this... fpc -dOS2GCC testhttp and it did compile with the defined code block... later, i wanted to test without that defined code block so i compiled again like this... fpc testhttp but the library wasn't recompiled... i had to manually remove the *.O and *.ppu files to get it recompiled without the defined code block... why?

Changing defines does not cause recompilation of units because e.g. the defines required to compile the FPC RTL or packages are completely unrelated to any defines that may or may not be required for compiling your program. In general, requiring you to specify all defines used for every unit you use in a program would result in an unmaintainable situation.

Additionally, there are some practical difficulties with adding hints for indicating such situations, see http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/compiler/fppu.pas?annotate=22452#l659

Jonas

Reply by email

Tomas Hajny
to Jonas Maebe
Jonas Maebe wrote 29 lines
On 28 Nov 2012, at 19:22, waldo kitty wrote: > on OS/2 eCS2 i have fpc 2.6.0 release installed... i've been working > with a library and needed to create a define so that some code would be > compiled that otherwise is not... since i have to compile from the > command line with fpc, i compiled my project like this... > > fpc -dOS2GCC testhttp > > and it did compile with the defined code block... later, i wanted to > test without that defined code block so i compiled again like this... > > fpc testhttp > > but the library wasn't recompiled... i had to manually remove the *.O > and *.ppu files to get it recompiled without the defined code block... > > why? Changing defines does not cause recompilation of units because e.g. the defines required to compile the FPC RTL or packages are completely unrelated to any defines that may or may not be required for compiling your program. In general, requiring you to specify all defines used for every unit you use in a program would result in an unmaintainable situation. Additionally, there are some practical difficulties with adding hints for indicating such situations, see http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/compiler/fppu.pas?annotate=22452#l659

In other words - it is normal, but you can solve it without manually deleting the created *.o and *.ppu files by using the -B parameter (which asks fpc to rebuild all units for which it has sources with the new command line parameters including conditional defines provided on the command line).

Tomas

Reply by email

waldo kitty
to Tomas Hajny
Tomas Hajny wrote 17 lines
On Wed, November 28, 2012 19:39, Jonas Maebe wrote: > Changing defines does not cause recompilation of units because e.g. the > defines required to compile the FPC RTL or packages are completely > unrelated to any defines that may or may not be required for compiling > your program. In general, requiring you to specify all defines used for > every unit you use in a program would result in an unmaintainable > situation. > > Additionally, there are some practical difficulties with adding hints for > indicating such situations, see > http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/compiler/fppu.pas?annotate=22452#l659 In other words - it is normal, but you can solve it without manually deleting the created *.o and *.ppu files by using the -B parameter (which asks fpc to rebuild all units for which it has sources with the new command line parameters including conditional defines provided on the command line).

ahhh... i see a script coming like i use with my TP/BP stuff when i compile from the command line... thanks to both of you for the answer...

Reply by email

waldo kitty
to Tomas Hajny: In other words - it is normal, but you can solve it without manually deleting the created…
Tomas Hajny wrote 5 lines
In other words - it is normal, but you can solve it without manually deleting the created *.o and *.ppu files by using the -B parameter (which asks fpc to rebuild all units for which it has sources with the new command line parameters including conditional defines provided on the command line).

haHA! yes! that fixed another problem we spoke of recently... now i /can/ get both sets of DLLs loading via the define... the -B was needed to rebuild both .pas files using the define... [digress] but the same problem is still there with that project :? if i can just get more responses on the synapse list, life might be better sooner rather than later ;) [/digress]

now i just have to remember to use -B every first time i compile and then do not use it the second time which is required to get around the "doubled path" problem when linking... at least, until FPC 2.6.1 finally gets out the door...

it would make a nice birthday present if it were to appear within the next 7 days OB-) :lol:

Reply by email