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

Home » Public Forums » archive » Re: Cant find functions in lib
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Cant find functions in lib [message #24528] Thu, 05 April 2001 07:49 Go to next message
Paul van Delst is currently offline  Paul van Delst
Messages: 364
Registered: March 1997
Senior Member
Dominik wrote:
>
> Helle there,
>
> I am using IDL for imaging in Nuklear Medicine. We wrote a big library
> (NukMed.pro) with some functions and dont wont to compile it each time. So
> we thought to put it in the lib directory of IDL, where IDL itself puts all
> its *.pro.
> But when we try to use it, IDL doesnt find the functions we used the whole
> time. Do I have to precompile it or to sign up in a special list for all
> *.pro files?

My solution to this is not to create a library *file* (like NukMed.pro) with all the
goodies but a library *directory* (like ~/pvandelst/idl/NukMed) which contains all the
_separate_ files. The directory, which is beneath the idl directory, is then automagically
added to my IDL_PATH environment variable because I do a: export
IDL_PATH=$IDL_PATH:+\${HOME}/idl

Anything below ${HOME}/idl is tacked on the end of the path.

paulv

--
Paul van Delst A little learning is a dangerous thing;
CIMSS @ NOAA/NCEP Drink deep, or taste not the Pierian spring;
Ph: (301)763-8000 x7274 There shallow draughts intoxicate the brain,
Fax:(301)763-8545 And drinking largely sobers us again.
paul.vandelst@noaa.gov Alexander Pope.
Re: Cant find functions in lib [message #24533 is a reply to message #24528] Thu, 05 April 2001 07:54 Go to previous messageGo to next message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Dominik (dpaul@ukl.uni-freiburg.de) writes:

> Has it really to be the LAST program module ? I think it is working also
> with other "places" in the file. Or will the module only find functions in
> freont of him in the file?

Yes, it has to be LAST, but really only if you want it
to work all of the time. :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: Cant find functions in lib [message #24536 is a reply to message #24528] Thu, 05 April 2001 06:48 Go to previous messageGo to next message
Dominik[1] is currently offline  Dominik[1]
Messages: 46
Registered: April 2001
Member
Of course I ment a subdirectory from Lib, which was "the same" for me.

Dominik

"Martin Schultz" <martin.schultz@dkrz.de> schrieb im Newsbeitrag
news:3ACC6F72.7BE281F3@dkrz.de...
> Dominik wrote:
>>
>> Helle there,
>>
>> I am using IDL for imaging in Nuklear Medicine. We wrote a big library
>> (NukMed.pro) with some functions and dont wont to compile it each time.
So
>> we thought to put it in the lib directory of IDL, where IDL itself puts
all
>> its *.pro.
>
> A *very* bad idea, indeed! You should not mingle user subroutines with
> the code supplied by RSI or you are bound for trouble.
>
>
> Martin
>
>
>
>> But when we try to use it, IDL doesnt find the functions we used the
whole
>> time. Do I have to precompile it or to sign up in a special list for all
>> *.pro files?
>>
>> Thanks
>> Dominik
>
> --
> [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[
> [[ Dr. Martin Schultz Max-Planck-Institut fuer Meteorologie [[
> [[ Bundesstr. 55, 20146 Hamburg [[
> [[ phone: +49 40 41173-308 [[
> [[ fax: +49 40 41173-298 [[
> [[ martin.schultz@dkrz.de [[
> [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[
Re: Cant find functions in lib [message #24538 is a reply to message #24536] Thu, 05 April 2001 06:01 Go to previous messageGo to next message
Dominik[1] is currently offline  Dominik[1]
Messages: 46
Registered: April 2001
Member
Has it really to be the LAST program module ? I think it is working also
with other "places" in the file. Or will the module only find functions in
freont of him in the file?

Dominik
"David Fanning" <davidf@dfanning.com> schrieb im Newsbeitrag
news:MPG.153619385014b126989dcc@news.frii.com...
> Dominik (dpaul@ukl.uni-freiburg.de) writes:
>
>> I am using IDL for imaging in Nuklear Medicine. We wrote a big library
>> (NukMed.pro) with some functions and dont wont to compile it each time.
So
>> we thought to put it in the lib directory of IDL, where IDL itself puts
all
>> its *.pro.
>> But when we try to use it, IDL doesnt find the functions we used the
whole
>> time. Do I have to precompile it or to sign up in a special list for all
>> *.pro files?
>
> If you find you have to "compile" the code before
> you can use it, then the code is not written correctly.
> Putting it in the lib directory won't help, alas. :-(
>
> If code is written so that the *last* program module in
> the file has the same name as the program file, which will
> also be the "name" of the command you are trying to build,
> then this program will be automatically compiled when
> the "command" is used, assuming the file is anywhere
> in the !PATH.
>
> You never have to pre-compile anything in IDL, assuming you
> have written it correctly.
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting
> Phone: 970-221-0438 E-Mail: davidf@dfanning.com
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
> Toll-Free IDL Book Orders: 1-888-461-0155
Re: Cant find functions in lib [message #24543 is a reply to message #24538] Thu, 05 April 2001 06:13 Go to previous messageGo to next message
Martin Schultz is currently offline  Martin Schultz
Messages: 515
Registered: August 1997
Senior Member
Dominik wrote:
>
> Helle there,
>
> I am using IDL for imaging in Nuklear Medicine. We wrote a big library
> (NukMed.pro) with some functions and dont wont to compile it each time. So
> we thought to put it in the lib directory of IDL, where IDL itself puts all
> its *.pro.

A *very* bad idea, indeed! You should not mingle user subroutines with
the code supplied by RSI or you are bound for trouble.


Martin



> But when we try to use it, IDL doesnt find the functions we used the whole
> time. Do I have to precompile it or to sign up in a special list for all
> *.pro files?
>
> Thanks
> Dominik

--
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[
[[ Dr. Martin Schultz Max-Planck-Institut fuer Meteorologie [[
[[ Bundesstr. 55, 20146 Hamburg [[
[[ phone: +49 40 41173-308 [[
[[ fax: +49 40 41173-298 [[
[[ martin.schultz@dkrz.de [[
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[
Re: Cant find functions in lib [message #24544 is a reply to message #24538] Thu, 05 April 2001 06:06 Go to previous messageGo to next message
Jaco van Gorkom is currently offline  Jaco van Gorkom
Messages: 97
Registered: November 2000
Member
Dominik wrote:
...
>> We wrote a big library
>> (NukMed.pro) with some functions and dont wont to compile it each time. So
>> we thought to put it in the lib directory of IDL, where IDL itself puts all
>> its *.pro.
...
> If somebody wants to know the solution: The procedure must have the same
> name as the file. So only on function in the file is accessible in the file.
> Of course the lib has to be in a right directory.

Right. There are a few more catches: the procedure with the same name as the
file must be the *last* procedure in the file, since IDL will stop compiling
after that. For a large library, you could put each function in its own file,
and put all those files in a directory NukMed. IDL will find all functions
automatically, provided that the NukMed directory is added to the path (in the
IDLDE preferences, in an IDL startup script or in an environment variable).

The other catch: the filenames must be all lowercase in order for IDL to find
them.

cheers,
Jaco
Re: Cant find functions in lib [message #24546 is a reply to message #24538] Thu, 05 April 2001 05:55 Go to previous messageGo to next message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Dominik (dpaul@ukl.uni-freiburg.de) writes:

> I am using IDL for imaging in Nuklear Medicine. We wrote a big library
> (NukMed.pro) with some functions and dont wont to compile it each time. So
> we thought to put it in the lib directory of IDL, where IDL itself puts all
> its *.pro.
> But when we try to use it, IDL doesnt find the functions we used the whole
> time. Do I have to precompile it or to sign up in a special list for all
> *.pro files?

If you find you have to "compile" the code before
you can use it, then the code is not written correctly.
Putting it in the lib directory won't help, alas. :-(

If code is written so that the *last* program module in
the file has the same name as the program file, which will
also be the "name" of the command you are trying to build,
then this program will be automatically compiled when
the "command" is used, assuming the file is anywhere
in the !PATH.

You never have to pre-compile anything in IDL, assuming you
have written it correctly.

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: Cant find functions in lib [message #24547 is a reply to message #24546] Thu, 05 April 2001 05:05 Go to previous messageGo to next message
Dominik[1] is currently offline  Dominik[1]
Messages: 46
Registered: April 2001
Member
Helle there,

I found the solution by myself (just looking very sharp on it...)

If somebody wants to know the solution: The procedure must have the same
name as the file. So only on function in the file is accessible in the file.
Of course the lib has to be in a right directory.

Dominik


"Dominik" <dpaul@ukl.uni-freiburg.de> schrieb im Newsbeitrag
news:9ahc7r$18l$1@n.ruf.uni-freiburg.de...
> Helle there,
>
> I am using IDL for imaging in Nuklear Medicine. We wrote a big library
> (NukMed.pro) with some functions and dont wont to compile it each time. So
> we thought to put it in the lib directory of IDL, where IDL itself puts
all
> its *.pro.
> But when we try to use it, IDL doesnt find the functions we used the whole
> time. Do I have to precompile it or to sign up in a special list for all
> *.pro files?
>
> Thanks
> Dominik
>
>
>
Re: Cant find functions in lib [message #24599 is a reply to message #24533] Thu, 05 April 2001 16:43 Go to previous message
Kenneth P. Bowman is currently offline  Kenneth P. Bowman
Messages: 585
Registered: May 2000
Senior Member
In article <MPG.1536350bbbff2315989dce@news.frii.com>, David Fanning
<davidf@dfanning.com> wrote:

> Yes, it has to be LAST, but really only if you want it
> to work all of the time. :-)

I have never understood the reason(s) for this, and find it somewhat
inconvenient. If I have (say) a procedure and a few related functions
that I would logically keep in the same file, it also seems logical to
me to put the "main" procedure (the one whose name matches the
filename) at the beginning of the file, rather than burying it at then
end. Why doesn't IDL simply compile everything in a file? What value
does the user get from stopping the compilation part of the way through
a file? (Aside from confusing newbies, of course, which has, at least,
mild entertainment value.)

Ken
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Was: Index... Now: Vectorize, huh?
Next Topic: why is using objects so much slower ?

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

Current Time: Wed Oct 08 13:37:41 PDT 2025

Total time taken to generate the page: 0.00520 seconds