Thread: C structure in perl typemap

  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, 05: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, 06: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