Bill Allombert on Sun, 05 Aug 2012 12:20:42 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Patch: default(sopath), default(outputsp[aces])


On Sun, Aug 05, 2012 at 02:15:10AM +0200, Karim Belabas wrote:
> I finally found time to go back to this patch proposed by Gonzalo Tornaria
> more than 8 years ago:
> 
>   <http://pari.math.u-bordeaux1.fr/archives/pari-dev-0401/msg00028.html>
> 
> ( Sorry it took so looong: so much to do, so little time :-( )
> 
> This one is not implemented as a defaut, but via the new function printsep(),
> suggested by Don Zagier:
> 
> (01:14) gp > ??printsep
> printsep(sep,{str}*):
> 
>    Outputs  its   (string)   arguments  in  raw format,  ending with a newline.

Currently it does not end by a newline.

? printsep(":", 1,2,3,4);print("e")
1:2:3:4e

> > 2) default(sopath):
> > 
> > similar to default(path), but for dynamic libraries loaded with
> > install(). The bulk of it is a function sd_sopath() [almost copied from
> > sd_path()], and gp_dlopen(), a wrapper for dlopen(). Note that if
> > default(sopath) is not set, gp_dlopen() defaults to the old dlopen().
> 
> Done.
> 
> I simplifed a bit the logic by refactoring:
> 
> - sd_path / sd_sopath are now subsumed in a generic routine meant to
>   handle an arbitrary gp_path structures [ path and sopath for now ].
> 
> - deciding whether we use the 'path' mechanism for a given file name is
>   handled by path_is_absolute()
> 
> - trying out all possible paths is now done through a simple iterator,
>   removing explicit allocation / concatenation from the involved routines
>   ( gp_dlopen(), gp_LoadLibrary(), switchin() )
> 
> > Note also that I allow the special path ":" to stand for "" (meaning:
> > revert back to the old behaviour), since there is no way to set a
> > default to an empty value!!! (since the argument "" is used to retrieve
> > the value of the default)
> 
> This is no longer true, we now use NULL instead of "". So no need
> to make the value special.
> 
> > I've only done it for dlopen(), but a similar wrapper should work for
> > win32 LoadLibrary().
> 
> I have implemented such a wrapper, but have no way to test it. (My last
> Windows system died 2 or 3 years ago.) Hopefully it works...

It does not seems to build with mingw:

i686-w64-mingw32-gcc  -c -I. -I../src/headers  -O3 -Wall -fno-strict-aliasing    -o plotWin32.o ../src/graph/plotWin32.c
../src/gp/highlvl.c: In function 'gp_LoadLibrary':
../src/gp/highlvl.c:103:5: warning: implicit declaration of function 'try_LoadLibrary' [-Wimplicit-function-declaration]
../src/gp/highlvl.c:103:5: warning: return makes pointer from integer without a cast [enabled by default]
../src/gp/highlvl.c:110:20: warning: assignment makes pointer from integer without a cast [enabled by default]
...
highlvl.o:highlvl.c:(.text+0x51): undefined reference to `_try_LoadLibrary'

Cheers,
Bill.