 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Randy W. Sims Guest
|
Posted: Wed Apr 05, 2006 3:03 am Post subject: Syntax for quoting define macros differs between response fi |
|
|
I'm working on a project, Module::Build, which is a perl module that
acts sort of like 'make', for building and installing perl modules and
extensions. This is a replacement/alternative to the long-standing
ExtUtils::MakeMaker and will be included in the next major release of
perl, version 5.10.
We need to invoke various compilers on different platforms to build some
perl extensions. One of these is the borland command line compiler on
Windows. I've written most of the code, and most things work correctly
but I'm running into a problem with defines and response files.
(Currently we use response files for all compilers under Windows to
avoid long command lines.)
Given the C program, 'test.c':
----------8<----------
#include <stdio.h>
int main()
{
char *ch;
ch = VERSION;
printf("%s\n", ch);
return 0;
}
----------8<----------
The following command line can be used to compile it:
bcc32 -DVERSION=\"1.01\" test.c
But with a response file, 'test.rsp':
----------8<----------
-DVERSION=\"1.01\"
----------8<----------
the result is:
C:\home\randys>bcc32 @test.rsp test.c
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
test.c:
Error E2206 test.c 7: Illegal character '\' (0x5c) in function main
Error E2206 test.c 7: Illegal character '\' (0x5c) in function main
Error E2060 test.c 7: Illegal use of floating point in function main
*** 3 errors in Compile ***
So, How do I handle quoting of define macros in response files?
Thanks,
Randy.
BTW, if it helps, a typical response file for the compiler currently
looks like:
----------8<----------
-O2
-D_RTLDLL
-DWIN32
-DHAVE_DES_FCRYPT
-D_MT
-D__USELOCALES__
-D_WIN32_WINNT=0x0410
-DPERL_IMPLICIT_CONTEXT
-DPERL_IMPLICIT_SYS
-O2
-D_RTLDLL
-DXS_VERSION=\"0.01\"
-DVERSION=\"0.01\"
-I"..\..\..\lib\CORE"
-I"C:\devel\bcc\5.5\include"
----------8<---------- |
|
| Back to top |
|
 |
Jonathan Benedicto Guest
|
Posted: Wed Apr 05, 2006 3:03 am Post subject: Re: Syntax for quoting define macros differs between respons |
|
|
Randy W. Sims wrote:
| Quote: | But with a response file, 'test.rsp':
-DVERSION=\"1.01\"
|
AFAIK, leave off the escape characters. Make it -DVERSION="1.0.1"
HTH
Jonathan |
|
| Back to top |
|
 |
Randy W. Sims Guest
|
Posted: Wed Apr 05, 2006 4:03 am Post subject: Re: Syntax for quoting define macros differs between respons |
|
|
Jonathan Benedicto wrote:
| Quote: | Randy W. Sims wrote:
But with a response file, 'test.rsp':
-DVERSION=\"1.01\"
AFAIK, leave off the escape characters. Make it -DVERSION="1.0.1"
|
Mmm, sorry, I should have mentioned that I tried that:
C:\home\randys>bcc32 @test.rsp test.c
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
test.c:
Error E2060 test.c 7: Illegal use of floating point in function main
*** 1 errors in Compile ***
zero, one, two, three quotes. With and without escape.
No luck.
Thanks,
Randy. |
|
| Back to top |
|
 |
Bill Guest
|
Posted: Wed Apr 05, 2006 6:03 am Post subject: Re: Syntax for quoting define macros differs between respons |
|
|
"Randy W. Sims" <randys (AT) thepierianspring (DOT) org> wrote in message
news:44332bb0$1 (AT) newsgroups (DOT) borland.com...
| Quote: |
----------8<----------
-DVERSION=\"1.01\"
----------8<----------
|
Try -DVERSION="\"1.01\"" assuming you want a ouput of "1.01" (quotes
included).
The way I see it you are currently expanding the macro as
char *ch;
ch = \"1.01\" ; // <<< not a null terminated string. |
|
| Back to top |
|
 |
Ed Mulroy Guest
|
Posted: Wed Apr 05, 2006 10:03 pm Post subject: Re: Syntax for quoting define macros differs between respons |
|
|
Another person ran into this earlier in the year
When you enclose something in quotes on the command line, that allows
special characters such as a space to be part of a single command line
argument and the program sees the full contents between the quotes without
the quotes as an individual calling argument.
However when it was in a response file it did not seem to work that way.
The parts on each side of the space were taken as separate arguments.
I've no workaround to suggest other than to put the arguments which are
enclosed in quotes on the actual command line or in the config file.
.. Ed
| Quote: | Randy W. Sims wrote in message
news:44332bb0$1 (AT) newsgroups (DOT) borland.com...
I'm working on a project, Module::Build, which is a perl module that acts
sort of like 'make', for building and installing perl modules and
extensions. This is a replacement/alternative to the long-standing
ExtUtils::MakeMaker and will be included in the next major release of
perl, version 5.10.
We need to invoke various compilers on different platforms to build some
perl extensions. One of these is the borland command line compiler on
Windows. I've written most of the code, and most things work correctly but
I'm running into a problem with defines and response files. (Currently we
use response files for all compilers under Windows to avoid long command
lines.)
Given the C program, 'test.c':
----------8<----------
#include <stdio.h
int main()
{
char *ch;
ch = VERSION;
printf("%s\n", ch);
return 0;
}
----------8<----------
The following command line can be used to compile it:
bcc32 -DVERSION=\"1.01\" test.c
But with a response file, 'test.rsp':
----------8<----------
-DVERSION=\"1.01\"
----------8<----------
the result is:
C:\home\randys>bcc32 @test.rsp test.c
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
test.c:
Error E2206 test.c 7: Illegal character '\' (0x5c) in function main
Error E2206 test.c 7: Illegal character '\' (0x5c) in function main
Error E2060 test.c 7: Illegal use of floating point in function main
*** 3 errors in Compile ***
So, How do I handle quoting of define macros in response files?
Thanks,
Randy.
BTW, if it helps, a typical response file for the compiler currently looks
like:
----------8<----------
-O2
-D_RTLDLL
-DWIN32
-DHAVE_DES_FCRYPT
-D_MT
-D__USELOCALES__
-D_WIN32_WINNT=0x0410
-DPERL_IMPLICIT_CONTEXT
-DPERL_IMPLICIT_SYS
-O2
-D_RTLDLL
-DXS_VERSION=\"0.01\"
-DVERSION=\"0.01\"
-I"..\..\..\lib\CORE"
-I"C:\devel\bcc\5.5\include"
----------8<---------- |
|
|
| Back to top |
|
 |
Randy W. Sims Guest
|
Posted: Thu Apr 06, 2006 3:03 am Post subject: Re: Syntax for quoting define macros differs between respons |
|
|
Bill wrote:
| Quote: | "Randy W. Sims" <randys (AT) thepierianspring (DOT) org> wrote in message
news:44332bb0$1 (AT) newsgroups (DOT) borland.com...
----------8<----------
-DVERSION=\"1.01\"
----------8<----------
Try -DVERSION="\"1.01\"" assuming you want a ouput of "1.01" (quotes
included).
The way I see it you are currently expanding the macro as
char *ch;
ch = \"1.01\" ; // <<< not a null terminated string.
|
I've tried that one too; and I just double checked to make sure:
Error E2206 test.c 7: Illegal character '\' (0x5c) in function main
Error E2206 test.c 7: Illegal character '\' (0x5c) in function main
Error E2060 test.c 7: Illegal use of floating point in function main
*** 3 errors in Compile ***
I've tried just about every combination I can think of. Unless there is
a different escaping character I don't know about, I don't think it's
possible. That stinks. =( This doesn't seem that unusual a thing to
want to do.
Regards,
Randy. |
|
| Back to top |
|
 |
Randy W. Sims Guest
|
Posted: Thu Apr 06, 2006 3:03 am Post subject: Re: Syntax for quoting define macros differs between respons |
|
|
Ed Mulroy wrote:
| Quote: | Another person ran into this earlier in the year
When you enclose something in quotes on the command line, that allows
special characters such as a space to be part of a single command line
argument and the program sees the full contents between the quotes without
the quotes as an individual calling argument.
However when it was in a response file it did not seem to work that way.
The parts on each side of the space were taken as separate arguments.
|
I don't think that's quite the problem. The problem is that I need to
pass the quotes in as part of the argument, but there doesn't seem to be
a way to do it. It works from the command line, but /all/ quotes are
stripped in the response file:
-DVERSION=""""""1.01""""""
Error E2060 test.c 7: Illegal use of floating point in function main
*** 1 errors in Compile ***
| Quote: | I've no workaround to suggest other than to put the arguments which are
enclosed in quotes on the actual command line or in the config file.
|
It works as expected in the config file, but there can only be one
config file, so if I put my defs in config files, it will not load the
users config file... It can't find the standard libraries.
It looks the only option left is putting them on the command line. :(
Regards,
Randy. |
|
| Back to top |
|
 |
Bob Gonder Guest
|
Posted: Thu Apr 06, 2006 9:03 am Post subject: Re: Syntax for quoting define macros differs between respons |
|
|
Randy W. Sims wrote:
| Quote: | It looks the only option left is putting them on the command line.
|
Or in a header file
version.h
- - - - - - -
#define VERSION "1.01" |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|