Hi Patrick,

It seems like you followed my advice to email the list, but did not read the 
rest of my earlier email. I reproduce part of it here with a new addition in 
bold:

“Extending and Embedding Perl” is a book (from 2002) added: not a manual, and 
it looks to me like you’re using that. Since 2002, the API for “converttype” 
has changed to remove the obsolete 3rd parameter (in fact, the Changes file 
reminds me that was in 2.057_01, in Sep 2021). The PDL C API is somewhat 
documented in PDL::API (https://metacpan.org/dist/PDL/view/Basic/Pod/API.pod - 
use that instead of the book) emphasis added, but the best “source of truth” is 
pdlcore.h.

Another approach to writing your own C/PDL code is to use 
https://metacpan.org/pod/Inline::Pdlpp which for normal usage I would recommend 
instead. A non-trivial use of this can be seen at 
https://github.com/Fourmilab/floating_point_benchmarks/pull/1/files.

I would highly recommend you subscribe to one of the PDL mailing lists 
(https://pdl.perl.org/?page=mailing-lists) and ask questions there, so that 
you’re not relying on my availability :-)

If you can better spell out what you’re actually trying to achieve (since the 
example from the 2002 book does not do anything that doesn’t already exist in 
PDL operations), perhaps someone here can actually help.

I will also link here to the “PDL book” (https://pdl.perl.org/?page=FirstSteps) 
and the article “Practical Magick with C, PDL, and PDL::PP -- a guide to 
compiled add-ons for PDL” (https://arxiv.org/abs/1702.07753).

Best regards,
Ed

From: Patrick Dupre<mailto:pdu...@gmx.com>
Sent: 17 July 2022 21:31
To: pdl-general@lists.sourceforge.net<mailto:pdl-general@lists.sourceforge.net>
Subject: [Pdl-general] converttype

Hello,

Before version 2.80, I used to follow the manual
Extending and Embedding Perl
1) Is there an alternative manual?
2) Here is my code (see p. 196 of the manual).
SV *piddle = HeVAL (he) ;
pdl *array = INT2PTR (pdl*, SvIV ((SV*) SvRV (piddle))) ;
PDL -> converttype (&array, PDL_D, 1) ;

Now, the compilation fails

Cores.xs:146:37: warning: passing argument 1 of ‘PDL->converttype’ from 
incompatible pointer type [-Wincompatible-pointer-types]
  146 |                 PDL -> converttype (&array, PDL_D, 1) ;
      |                                     ^~~~~~
      |                                     |
      |                                     pdl **
Cores.xs:146:37: note: expected ‘pdl *’ but argument is of type ‘pdl **’
Cores.xs:146:17: error: too many arguments to function ‘PDL->converttype’
  146 |                 PDL -> converttype (&array, PDL_D, 1) ;


It seems that the function converttype differs from the previous versions.
I cannot find how I could modify my code for passing the compilation
with the same behavior.

Can somebody help me?

Thank.

===========================================================================
 Patrick DUPRÉ                                 | | email: pdu...@gmx.com
 Laboratoire interdisciplinaire Carnot de Bourgogne
 9 Avenue Alain Savary, BP 47870, 21078 DIJON Cedex FRANCE
 Tel: +33 (0)380395988                    | | Room# D114A
===========================================================================



_______________________________________________
pdl-general mailing list
pdl-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pdl-general

_______________________________________________
pdl-general mailing list
pdl-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pdl-general

Reply via email to