Singular
https://www.singular.uni-kl.de/forum/

How to check if a library is loaded?
https://www.singular.uni-kl.de/forum/viewtopic.php?f=10&t=1681
Page 1 of 1

Author:  georgm [ Sun Aug 24, 2008 8:16 am ]
Post subject:  How to check if a library is loaded?

I would like to automatically check if a library is loaded. One idea was to use "listvar(package)", but this seems to print such a list to the screen, rather than return an object that I can search through.

I think this used to be possible in Singular 2 with "string(LIB)", but that doesn't seem to be the case anymore.

Does anybody know how to do this?

Author:  Guest [ Sun Aug 24, 2008 6:32 pm ]
Post subject: 

In Singular-2.x you could look up the global variable LIB (of type string) and search
for the library using the command find e.g.

Code:
> LIB;
standard.lib
> find("LIB","standard.lib");
1
> find(LIB,"ring.lib");
0
> LIB "ring.lib";
// ** loaded /usr/o0/Singular-203/sparcv7-sun-solaris2.7/Singular/2-0-3/LIB/ring.lib (1.17.2.1,2002/02/20)
// some more output here
> LIB;
standard.lib,ring.lib,general.lib,matrix.lib,random.lib,poly.lib,inout.lib
> find(LIB,"ring.lib");
14


This does no longer work, as LIB is now the string "_".

In Singular-3.x you have to use the command defined
with capitalized first letter of the library (without the trailing .lib):

Code:
> defined(Sing);
0
> LIB "sing.lib";
// ** loaded /LIB/sing.lib (1.30,2006/08/02)
> defined(Sing);
1

Author:  georgm [ Mon Aug 25, 2008 10:36 pm ]
Post subject: 

Perfect, that works. Thanks a lot!

Page 1 of 1 All times are UTC + 1 hour [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/