Is System Dependent Compilation Possible? [message #6110] |
Wed, 24 April 1996 00:00  |
Tim Patterson
Messages: 65 Registered: October 1995
|
Member |
|
|
I have a tool written in IDL/Fortran and C that needs to
run on both Unix and VMS systems. I have a few system
dependent IDL procedures that I use as wrappers for the
CALL_EXTERNALS.
What I would like to do is have a batch file, say
compile.pro, which can be invoked with @compile.pro
and will compile the correct version of wrappers
depending upon the OS, e.g.
IF !version.os EQ 'vms' then begin
.run vms_version.pro
ENDIF ELSE BEGIN
.run unix_version.pro
ENDELSE
Unfortunately, I can't seem to come up with anything
that even approaches this.
IF !version.os EQ 'vms' then .run vms_version.pro
produces an error.
Anybody got any ideas?
Thanks
Tim
|
|
|
Re: Is System Dependent Compilation Possible? [message #6185 is a reply to message #6110] |
Mon, 29 April 1996 00:00  |
David Foster
Messages: 341 Registered: January 1996
|
Senior Member |
|
|
Tim Patterson <tim@raptor.lpl.arizona.edu> wrote:
>
> I have a tool written in IDL/Fortran and C that needs to
> run on both Unix and VMS systems. I have a few system
> dependent IDL procedures that I use as wrappers for the
> CALL_EXTERNALS.
>
> What I would like to do is have a batch file, say
> compile.pro, which can be invoked with @compile.pro
> and will compile the correct version of wrappers
> depending upon the OS,
>
> Unfortunately, I can't seem to come up with anything
> that even approaches this.
>
> IF !version.os EQ 'vms' then .run vms_version.pro
>
> produces an error.
>
I have always wanted to use the .run executive command within
procedures. Seems strange that you can't. I tried using the
@routine.pro syntax but had problems.
You might find a work-around for this, but I would suggest
putting the system-dependent code inside your wrapper functions,
since that's more consistent with the purpose of using a
wrapper function in the first place. Or you might have a
"master" wrapper function that calls other "sub-" wrapper
functions according to the value of !VERSION.OS .
The second approach would have the same effect as your
previous attempt ... only the sub-wrapper that gets called would
be compiled.
Dave Foster
foster@bial1.ucsd.edu
|
|
|
Re: Is System Dependent Compilation Possible? [message #6200 is a reply to message #6110] |
Fri, 26 April 1996 00:00  |
Ken Knighton
Messages: 44 Registered: May 1995
|
Member |
|
|
> Making the branch in the IDL code itself would work
> for a small number of routines. Unfortunately I
> have to have wrappers for around 50+ Fortran routines
> and it becomes very tedious editing every routine
> in that manner :)
I'm not going to guarantee that this will work, but on Unix, you
may be able to use cpp (the C preprocessor) or m4 to preprocess your
batch files that build the executable. You would have to do your
builds on Unix though. I have never done this myself, but have
seen cpp used for purposes other than preprocessing C code.
I hope this helps.
Ken Knighton kknighton@qualcomm.com knighton@cts.com
San Diego CA ^^^^^^^^^^^^^
Note new address
P.S. - I have changed employers and will be doing non-idl related
stuff such as C++/embedded systems on the job. I will still be
lurking though. What can I say, they gave me an offer I couldn't
refuse. $-)
|
|
|