[YLUG] Perl/c

Patrick Dupre pd520 at york.ac.uk
Mon Jun 30 11:21:08 BST 2008


On Mon, 30 Jun 2008, Steve Kemp wrote:

> On Mon Jun 30, 2008 at 01:09:10 +0100, Patrick Dupre wrote:
>
>> I have a c struct which is retuned my a c routine (in fact it returns a
>> pointer on the structure).
>
>> How can I access to this structure from a perl program. I tried
>> Inline::struct, but I was not been successful.
>
>  You probably want to look at Inline::C.
I did use Inline::Struct, is it the same ?
I was not able to make it work with a
routine returning a pointer on a struct, in addition, it seems that
I cannot have a:
double *a
inside the structure.

Inline::Struct seems OK to declare and allocate a new Structure with
a new, like:
my $profile = Inline::Struct::array_sized -> new ;

but in my case, the memory space is allocated in the
subroutine and only the pointer on the structure is returned. I did not
find a way to access to the elements of the structure.

$$profile -> element     does no work (is element is an element of the 
c structure)

Regards.

>
>  More generally you probably want to repost your question where it
> is more likely to receive attention.  I'd suggest perlmonks:
>
>    http://perlmonks.org/
>
> Steve
>

-- 
---
==========================================================================
  Patrick DUPRÉ                      |   |
  Department of Chemistry            |   |    Phone: (44)-(0)-1904-434384
  The University of York             |   |    Fax:   (44)-(0)-1904-432516
  Heslington                         |   |
  York YO10 5DD  United Kingdom      |   |    email: pd520 at york.ac.uk
==========================================================================


More information about the York mailing list