comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » calling a function in herself
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: calling a function [message #32898 is a reply to message #20893] Fri, 15 November 2002 10:24 Go to previous messageGo to previous message
James Kuyper is currently offline  James Kuyper
Messages: 425
Registered: March 2000
Senior Member
Steve wrote:
>
> Dear all, I have a problem!
> I have a program (main.pro) written in IDL. Then, inside the main.pro
> I want to use a function that I found on Goddard library.
> The function is named glactc.pro, and the calling sequence is the
> following:
> GLACTC, ra, dec, year, gl, gb, j
> How can I call glactc.pro inside main.pro?

If it's really a function (starts with the FUNCTION keyword), then you
have to type:

result = GLACTC(my_ra, my_dec, my_year, my_gl, my_bg, my_j)

On the other hand, if it's a procedure (starts with the PROC keyword),
then you have to type:

GLACTC, my_ra, my_dec, my_year, my_gl, my_bg, my_j

You don't need the 'my_' prefixes, I'm just emphasizing that the names
don't need to match; it's also not an error if they do match.

> After that, when I compile the program, do I have to link
> glactc.pro?If yes, how can I do that?

No. All you have to do is make sure that glactc.pro is in a directory
that's in IDL's search path. That can either be in your current
directory, or in one of the directories listed in the IDL_PATH
environment variable.
Alternatively, you can load glactc.pro, even if it's not in the
IDL_PATH, by
typing:

IDL> .run /non-idl/path/name/glactc.pro

You don't need to add the '.pro' at the end; IDL will figure it out if
you leave it out.

Note: if the name of the file is different from the name of the
procedure or function that you need to execute, then you have to use the
'.run' approach. That's why it's generally a good idea to have the
function and the filename match.

> Is it possible to write "makefile" (like C programming) into IDL?

No, but the reason it's not possible is that it's not really needed.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Structure Pass By Reference?
Next Topic: Problems getting CURVEFIT to work

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Oct 12 07:03:41 PDT 2025

Total time taken to generate the page: 0.80769 seconds