Karim Belabas on Tue, 06 Jun 2023 20:27:45 +0200


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

Re: Different behavior in library mode (PARI) vs. in GP (when using Z_issmooth)


* Daniel Berger [2023-06-06 19:52]:
[...]
> If I however compile this as part of a shared library and install it for use
> in gp, it doesn't. It appears to me that `Z_issmooth` always returns 1, for
> example `function(10, 2, 3)` now returns `[1, 8, 49, 288]`. I tried testing
> `Z_issmooth` separately in gp by installing it with
> `install(Z_issmooth,"GU",smoothtest,"libpari.so")` and for example
> `smoothtest(408,10)` (should return 0) but it breaks with a segmentation
> fault.
[...]

Z_issmooth return a long integer, so the correct prototype code is lGU 
instead of GU (default type 'GEN' for the return value):

  install(Z_issmooth,"lGU",smoothtest,"libpari.so")

Cheers,

    K.B.
-- 
Pr. Karim Belabas, U. Bordeaux, Vice-président en charge du Numérique
Institut de Mathématiques de Bordeaux UMR 5251 - (+33) 05 40 00 29 77
http://www.math.u-bordeaux.fr/~kbelabas/