PDL

2012-03-04 Thread Patrick Dupre
Hello, After an upgrade from fedora 13 to fedora 14, my application fails with: PDL::LinearAlgebra::Real needs to be recompiled against the newly installed PDL at /usr/lib64/perl5/DynaLoader.pm line 223 I just reinstall perl::LinearAlgebra which contains Real. PDL has also been recompiled.

bignum t float

2011-06-19 Thread Patrick Dupre
Hello, I need to convert the result of an aritmetic operation on 2 bignum into a normal float (ie double) I did not find a way to do this. no bignum ; my $res = $A - $B ; gives me always a bignum ($res) if $A and $B are bignum. Thank. -- ---

Re: bignum t float

2011-06-19 Thread Patrick Dupre
On Sun, 19 Jun 2011, Rob Dixon wrote: On 19/06/2011 14:07, Patrick Dupre wrote: Hello, I need to convert the result of an aritmetic operation on 2 bignum into a normal float (ie double) I did not find a way to do this. no bignum ; my $res = $A - $B ; gives me always a bignum ($res

Re: bignum t float

2011-06-19 Thread Patrick Dupre
On Sun, 19 Jun 2011, Uri Guttman wrote: PD == Patrick Dupre patrick.du...@york.ac.uk writes: PD There is not option like (double) $res ? rtfm to the rescue! the synopsis shows how to do it. since it is a pragma it affects all calculations in the scope. disabling the pragma is how you can

perl call fortran

2011-05-01 Thread Patrick Dupre
Hello, Is perl able to load a fortran subroutine ? I have no problem to make a c code callable by gcc (xs) I can call a fortran routine from a c program. But perl fails to load a so library linked with a piece of fortran. The error is: cannot restore segment prot after reloc: Permission

Re: perl call fortran

2011-05-01 Thread Patrick Dupre
On Sun, 1 May 2011, Kenneth Wolcott wrote: On Sun, May 1, 2011 at 14:36, Patrick Dupre patrick.du...@york.ac.ukwrote: Hello, Is perl able to load a fortran subroutine ? I have no problem to make a c code callable by gcc (xs) I can call a fortran routine from a c program. But perl fails

pushs in xs

2011-04-08 Thread Patrick Dupre
Hello, I created my interface in c by using xs. This work fine: transition_HF* init___ () PREINIT: transition_HF *trans ; CODE: trans = (transition_HF*) malloc (sizeof (transition_HF)) ; RETVAL = trans ; OUTPUT: RETVAL but if I make a push: like: XPUSHs (sv_2mortal

Error

2010-12-05 Thread Patrick Dupre
Hello, Can somebody tell me why this example does not work ? Number found where operator expected at ./Test.pl line 12, near case 0 (Do you need to predeclare case?) syntax error at ./Test.pl line 11, near ) { Execution of ./Test.pl aborted due to compilation errors.

Imager::Plot

2010-12-04 Thread Patrick Dupre
Hello, I tried to install Imager::Plot but it failed: CPAN.pm: Going to build A/AD/ADDI/Imager-Plot-0.09.tar.gz Unable to load any fonts! please make sure that Imager was compiled with support for one of the following libraries: freetype1, freetype2, libt1, win32 Warning: No success on

gsl/XS

2010-07-16 Thread Patrick Dupre
Hello, Could somebody tell me what is wrong with this code (I get a segmentation fault): #include EXTERN.h #include perl.h #include XSUB.h #include stdlib.h #include gsl/gsl_matrix.h typedef gsl_matrix* Math__GSL__Matrix__gsl_matrix ; #include const-c.inc MODULE = Test_gsl PACKAGE

ExtUtils

2010-05-14 Thread Patrick Dupre
Hello, The comand: perl -MExtUtils::Embed -e ccopts gives me: -D_REENTRANT -D_GNU_SOURCE -DPERL_USE_SAFE_PUTENV -DDEBUGGING -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -I/usr/lib64/perl5/5.10.0/x86_64-linux-thread-multi/CORE

perl in Makefile

2010-05-13 Thread Patrick Dupre
Hello, How can I execute the following command in a Makefile ? CORE_INC=`perl -MConfig -MFile::Spec::Functions -le 'print catfile($Config{archlib},CORE)')` The problem is with the $Config ! thank -- --- == Patrick

free memory

2010-04-13 Thread Patrick Dupre
Hello, I have the a hash of hash of ... of array (see below hwo I can list it) whose i wish to free the memory at one point. Right now the desallocation is not clean, ie that evert time that I reallocate the hash, the programme requires more and mor space and finally swap the memory ! How can I

XS linker

2010-04-07 Thread Patrick Dupre
Hello, I created a library .so by using XS. I need to dynamically link this library to another library (size 12822538). How can I do ? I get an error message: Can't load '/home/pdupre/perl_lib/x86_64-linux-thread-multi/auto/Fitter_XAS/Fitter_XAS.so' for module Fitter_XAS:

Re: XS linker

2010-04-07 Thread Patrick Dupre
Sorry, I know, but I am still unable to subscribe to perl-xs I submitted the issu to the computer service but it is not solved yet ! Sorry for the inconvenient ! XS is anything BUT a beginner question. there is an xs mailing list you can post to or use some other forum like usenet or

Re: hv_store hoh

2010-04-01 Thread Patrick Dupre
thank, But perl-xs-subscr...@perl.org never responded to me No way to subscribe. On Wednesday 31 Mar 2010 18:36:43 Patrick Dupre wrote: Hello, How can I store in a hash (HV) another hash bu using XS ? Please ask it on the XS mailing list: perl...@perl.org (and perl-xs-subscr

free memory

2010-04-01 Thread Patrick Dupre
Hello, I cannot subscribe to perl-xs so, I am still posting here. I fill a hash of hash with xs. I wanted to free this hoh in perl, but it does not seem to be working. hoh = () or undef hoh does not free the memory. If I do the same call again, more memory is requested. Should I deallocated the

Re: free memory

2010-04-01 Thread Patrick Dupre
On Thu, 1 Apr 2010, Philip Potter wrote: On 1 April 2010 16:13, Patrick Dupre pd...@york.ac.uk wrote: Hello, I cannot subscribe to perl-xs so, I am still posting here. I don't understand the problem. I do not understand either, I did 3 times and I never get any feedback from the server

Re: hv_store hoh

2010-04-01 Thread Patrick Dupre
Hello, I do not know what to tell you. I tried another webmail, but I cannot sent an empty email with an empty subjet !!! 1. I was able to subscribe to perl-xs using that address just fine back when I did it. 2. You may have lost the E-mail or it was dropped by a relay. You should check

hv_store hoh

2010-03-31 Thread Patrick Dupre
Hello, How can I store in a hash (HV) another hash bu using XS ? Thanks. -- --- == Patrick DUPRÉ | | Department of Chemistry| |Phone: (44)-(0)-1904-434384 The University of York

XS and link

2010-03-30 Thread Patrick Dupre
Hello, I have a perl application calling c soubroutines. I use XS and makemaker to compile the code. Every thing OK. Now, let say that I have 2 c libraries (dynamics) created by XS and the makemaker, and I would like that one of the 2 c subroutines calls one of the subroubtine of the other

Re: piddle in hash

2010-02-08 Thread Patrick Dupre
On Sun, 7 Feb 2010, Patrick Dupre wrote: Hello, I have been unsuccessful in getting the piddle values when I store them in a hash so, I am asking to the list. This works OK: test_pdl (array) pdl *array CODE: PDL - converttype (array, PDL_D, 1) ; Sorry, I finally I know how to do it. I

piddle in hash

2010-02-07 Thread Patrick Dupre
Hello, I have been unsuccessful in getting the piddle values when I store them in a hash so, I am asking to the list. This works OK: test_pdl (array) pdl *array CODE: PDL - converttype (array, PDL_D, 1) ; when I do: test_pdl ($piddle) ; but when I do: %hash {A} = $piddle ; test_pdl

XS: Free memory

2009-09-06 Thread Patrick Dupre
Hello, When I do: XPUSHs (sv_2mortal (newRV_inc ((SV*) E_rot_up)) ; Do I need to free the memory ? I use the XPUSHs to pass an array of real to a perl sub, but I am not sure that after the call, this memory sapce is freed. Can I desallocate the memory space manually ? I tried to use valgrind to

Makefile.PL

2009-09-05 Thread Patrick Dupre
Hello, In my Makefile.PL, how can I have 2 MYEXTLIB ? I have 2 directories, on is OK, it is mylib I also would like to make a cd mylib2, and run the Makefile (make install). I tried to change the sub MY::postamble { ' $(MYEXTLIB): mylib/Makefile cd mylib $(MAKE) $(PASSTHRU)

Re: hash of hashes question

2009-09-04 Thread Patrick Dupre
On Fri, 4 Sep 2009, Noah Garrett Wallach wrote: Hi there, I am having some trouble understanding hash of hashes here. I want to find all the keys for %policy{'policy_statement'} for my $line (@lines) { for my $key ( keys %policy{'policy_statement'} ) { Check if $keys is

XS, get/set value when passing a ref

2009-08-01 Thread Patrick Dupre
Hello, I did fail in trying to change value in XS when I pass a reference: Typically: in perl: my $a = 5 ; test (\a) ; in XS void test (nb) int *nb CODE: (*nb)++ ; It does work, Should I use a ref on a ref ? -- ---

MakeMaker

2009-07-30 Thread Patrick Dupre
Hello, Insi de my Makefile.PL, I would like to do something like: LIBS = ['-lm -L$(PATH) -lmlib'], with $PATH define at the beginning of the file, but I cannot make it work What am I doing wrong ? Thank. -- --- ==

Re: MakeMaker

2009-07-30 Thread Patrick Dupre
Thank. On Thu, Jul 30, 2009 at 19:28, Patrick Duprepd...@york.ac.uk wrote: Hello, Insi de my Makefile.PL, I would like to do something like: LIBS   = ['-lm -L$(PATH) -lmlib'], with $PATH define at the beginning of the file, but I cannot make it work What am I doing wrong ? snip I see

pass int* to perl

2009-06-12 Thread Patrick Dupre
Hello, I need to call perl from c. To pass an integer, I use to make a newSViv. How do I do to pass a int* ? Should I just cast the int* to int ans passed as an SV ? in perl I need to get the value by $$var. Thank. -- ---

Dynamic library

2009-05-27 Thread Patrick Dupre
Hello, I used to build dynamic libraries in c (.so) that I can then call from perl. However, in c the static libraries are more efficient than the dynamic libraries. So can I call a static c library from perl ? for the dynamics library, in my Makefile.PL, I put: LIBS= ['-lm

XS av_store

2009-05-01 Thread Patrick Dupre
Hello, I created an Array, like: AV *out = newAV () ; then, I fill it with: SV *elem = sv_newmortal () ; sv_setnv (elem, val) ; av_push (out, elem) ; where val is a double. Then, I wanted to change one of the values, I did a av_fetch and it is OK (just to be sure) Then, an

Re: XS

2008-12-09 Thread Patrick Dupre
Thank, But I nned help. I will work more to make a short example, but it seems clear that something has changed between version 5.8.8 and version 5.10.0 I built up a cpp+ class which includes an array. When I try to access to this array with a method, I get a segmentation fault. Is it because

XS

2008-12-08 Thread Patrick Dupre
Hello, Since I upgrade my PC from perl 5.8.8 to 5.10.0, my application fails. I do not understand what is going on, memory leak ? Segmentation fault. I noticed warning which did not happen before: Please specify prototyping behavior for Fitter.xs (see perlxs manual) g++ -c -D_REENTRANT

XS

2008-12-03 Thread Patrick Dupre
Hello, How can I avoid the generation of the man3 file even if the file lib/file.pm can do it (I means will do it by default). Thank -- --- == Patrick DUPRÉ | | Department of Chemistry|

version 5.10.0

2008-12-02 Thread Patrick Dupre
Hello, I am experiencing 2 problems with the new version: 1) I have a .pl file which needs libraries located in the same directory (.pm), so I used to put: use lib '/home/pdupre/dir_name' ; inside my .pl file. That way, I was able to run the application from another directory by using a link.

XS array of arrays

2008-09-02 Thread Patrick Dupre
Hello, I wanted to return an array of arrays from c to perl. I build up my arrays by unisng av_push, but then ? I cannot av_push a AV*, so should I make a newSV and filled it by casting, or should I make a newRV with the AV* (after casting) and push it ? Thank -- ---

references and XS

2008-08-29 Thread Patrick Dupre
Hello, Calling a sub from perl, if this sub return an address on an array, it is not a problem, perl seems to manage correctly the memory to keep allocated, and I can access to the data through the reference at any time. Making the same call from a CPP method seems not to work. If I quit the

Re: references and XS

2008-08-29 Thread Patrick Dupre
Calling a sub from perl, if this sub return an address on an array, it is not a problem, perl seems to manage correctly the memory to keep allocated, and I can access to the data through the reference at any time. Making the same call from a CPP method seems not to work. If I quit the method and

Re: HV in XS

2008-08-27 Thread Patrick Dupre
Hello Rob, I am trying to investigate more, but, one problem seems to that that the SvTYPE (ret) is 3, ie that it is a RV reference when it should be a hash reference. Am I correct ? Patrick Dupre wrote: I am desesperated ! Assuming the following perl sub: sub sub1 { my

Re: HV in XS

2008-08-27 Thread Patrick Dupre
gives an error: Attempt to free unreferenced scalar: SV 0x8941998, Perl interpreter: 0x87b9008 at ./test.pl line 13 Somethnig does not make sense to me !!! I do not get the refernce properly for sure, but why ? Regards Patrick Dupre wrote: Rob Dixon wrote: It would be nice to have been

HV in XS

2008-08-26 Thread Patrick Dupre
I am desesperated ! Assuming the following perl sub: sub sub1 { my %a ; $a {a} = 1 ; $a {b} = 2 ; foreach (keys %a) { print $_, = , $a {$_}, \n ; } return \%a ; } Using XS, I am tring to get the hash using: PREINIT: int count ; SV *ret ; HV *ptr ; SV ** hv

XPUSHs

2008-08-25 Thread Patrick Dupre
Hello, I need to make a XPUSHs of a referene on an array, but XPUSHs takes only scalar, so it looks like that I need convert my AV* into a scalar with a newSV, but I do not know exactly. Can I have some help ? Regards -- ---

Re: Makefile.PL

2008-08-23 Thread Patrick Dupre
How can I modify my Makefile.PL to have a Makefile which can make cc -o test.o -c test.c `perl -MExtUtils::Embed -e ccopts` Thank Makefile.PL is a program written using ExtUtils::MakeMaker to generate a makefile for building a Perl /extension/ module. ExtUtils::Embed is a module that will

Re: Makefile.PL

2008-08-23 Thread Patrick Dupre
On Sun, 24 Aug 2008, Rob Dixon wrote: Patrick Dupre wrote: It is a bit more complex. I am a perl routine calling a Cpp routine, I wrote the xs to interface the call. I wrote the methods (in Cpp) for the Cpp class. In fact I need to use a Minuit2 class. One needs to call a function

Makefile.PL

2008-08-22 Thread Patrick Dupre
Hello, How can I modify my Makefile.PL to have a Makefile which can make cc -o test.o -c test.c `perl -MExtUtils::Embed -e ccopts` Thank -- --- == Patrick DUPRÉ | | Department of Chemistry

Re: Makefile.PL

2008-08-22 Thread Patrick Dupre
On Fri, 22 Aug 2008, Rob Dixon wrote: Patrick Dupre wrote: How can I modify my Makefile.PL to have a Makefile which can make cc -o test.o -c test.c `perl -MExtUtils::Embed -e ccopts` Thank Makefile.PL is a program written using ExtUtils::MakeMaker to generate a makefile for building a Perl

Re: Makefile.PL

2008-08-22 Thread Patrick Dupre
On Fri, 22 Aug 2008, Rob Dixon wrote: Patrick Dupre wrote: On Fri, 22 Aug 2008, Rob Dixon wrote: Patrick Dupre wrote: How can I modify my Makefile.PL to have a Makefile which can make cc -o test.o -c test.c `perl -MExtUtils::Embed -e ccopts` Thank Makefile.PL is a program written using

Re: Makefile.PL

2008-08-22 Thread Patrick Dupre
Hello Bob, So, you do not have any solution for me ? Regards. Patrick Dupre wrote: On Fri, 22 Aug 2008, Rob Dixon wrote: Patrick Dupre wrote: How can I modify my Makefile.PL to have a Makefile which can make cc -o test.o -c test.c `perl -MExtUtils::Embed -e ccopts` Thank Makefile.PL

XS

2008-07-30 Thread Patrick Dupre
Hello, Inside a c routine (ie. inside a .c file) is there any way to define a variable of type SV (or SV *) ? From xs, it is no problem. Regards -- --- == Patrick DUPRÉ | | Department of

Re: XS

2008-07-30 Thread Patrick Dupre
On Wed, 30 Jul 2008, Rob Dixon wrote: Patrick Dupre wrote: Inside a c routine (ie. inside a .c file) is there any way to define a variable of type SV (or SV *) ? From xs, it is no problem. Yes. You can say SV *var = PL_sv_undef; Where should I say it ? What I want, by using a c routine

Re: XS

2008-07-30 Thread Patrick Dupre
OK, it works by putting the header file at the beginig of my c file: EXTERN.h, etc. Regards Patrick Dupre wrote: Inside a c routine (ie. inside a .c file) is there any way to define a variable of type SV (or SV *) ? From xs, it is no problem. Yes. You can say SV *var = PL_sv_undef

XS

2008-07-25 Thread Patrick Dupre
Hello, I am trying to pass a array of references on array to a c subroutine: my @set_2d = ([0.0, 1.0], [1.1, 2.2], [3.1, 4.4]) ; test::test([EMAIL PROTECTED]) ; in xs I put: typedef double floatArray ; void * floatArrayPtr (int num) { SV * mortal ; mortal = sv_2mortal (NEWSV (0, num *

Re: XS

2008-07-25 Thread Patrick Dupre
Hello, I am trying to pass a array of references on array to a c subroutine: my @set_2d = ([0.0, 1.0], [1.1, 2.2], [3.1, 4.4]) ; test::test([EMAIL PROTECTED]) ; in xs I put: typedef double floatArray ; void * floatArrayPtr (int num) { SV * mortal ; mortal = sv_2mortal (NEWSV (0, num *

Re: XS

2008-07-25 Thread Patrick Dupre
Thank, Regards Patrick Dupre wrote: Hello, I am trying to pass a array of references on array to a c subroutine: my @set_2d = ([0.0, 1.0], [1.1, 2.2], [3.1, 4.4]) ; test::test([EMAIL PROTECTED]) ; in xs I put: typedef double floatArray ; void * floatArrayPtr (int num) { SV * mortal