C structure in perl typemap

This is a discussion on C structure in perl typemap within the Linux Programming forums, part of the Platform Specific Boards category; How do all? I'm calling some C code from perl by using XS. I've declared all the code in myprog.xs ...

  1. #1
    Registered User
    Join Date
    Aug 2002
    Posts
    351

    C structure in perl typemap

    How do all?

    I'm calling some C code from perl by using XS. I've declared all the code in myprog.xs but I'm not sure how to tell perl about my C struct.

    Do I edit ExtUtils/typemap? and if I do what do I add where?

    Perl also doesn't know about long*.

  2. #2
    Registered User
    Join Date
    Aug 2002
    Posts
    351
    Well, I got it working without using structs - it was more of a design issue.

    long * can be used by using void * in the XS declaration and a cast to long * in the C.

    This is pretty cool stuff though. Means I can call C library functions from Perl and maintain data (eg. persistent database connections)without using exec et al.

    Good chapter in Programming Perl (Wall et al) on this: 21 Internals and Externals.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem referencing structure elements by pointer
    By trillianjedi in forum C Programming
    Replies: 19
    Last Post: 06-13-2008, 06:46 PM
  2. Replies: 5
    Last Post: 02-14-2006, 09:04 AM
  3. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 07:39 AM
  4. Serial Communications in C
    By ExDigit in forum Windows Programming
    Replies: 7
    Last Post: 01-09-2002, 10:52 AM
  5. C structure within structure problem, need help
    By Unregistered in forum C Programming
    Replies: 5
    Last Post: 11-30-2001, 05:48 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21