Charles Greathouse on Wed, 25 Jul 2012 15:13:01 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: install name collision |
> You must make sure all install() and alias() commands are executed before any > GP functions using the new symbols are defined. Good to know. But isn't that what I'm doing? gp2c-run runs the install commands before loading the .gprc file, doesn't it? Charles Greathouse Analyst/Programmer Case Western Reserve University On Wed, Jul 25, 2012 at 6:41 AM, Bill Allombert <Bill.Allombert@math.u-bordeaux1.fr> wrote: > On Tue, Jul 24, 2012 at 10:58:14PM -0400, Charles Greathouse wrote: >> I wrote a .gp.c file which includes, among other things, a function >> called vecsum. It was based on a gp2c conversion, and includes >> >> GP;install("vecsum","G","vecsum","./auto.gp.so"); >> >> in a comment so that gp2c-run will load it. (Yes, this is a silly >> function, but I mention it up only for the bug report.) >> >> Usually this procedure works fine, and indeed it seems to here: >> >> >> *** at top-level: rec([23124110,141322 >> *** ^-------------------- >> *** in function findrecd: ...max(c)==1&&vecmin(c)==0&&vecsum(c)==1)||c==[1 >> *** ^-------------------- >> *** variable name expected. >> *** Break loop: type 'break' to go back to GP > > You must make sure all install() and alias() commands are executed before any > GP functions using the new symbols are defined. Otherwise the GP compiler use > the old value of the symbol instead of the new one. > > ? f(a)=addii(a,123); > ? install(addii,GG) > ? f(5) > *** at top-level: f(5) > *** ^---- > *** in function f: addii(a,123) > *** ^------------ > *** variable name expected. > > ... > > ? install(addii,GG) > ? f(a)=addii(a,123); > ? f(5) > %2 = 128 > > (by contrast, GP function are dynamic: you can define them after they are used > in other functions, but this incurs some penalties). > > Cheers, > Bill. >