#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2004
    Location
    Vancouver, Canada
    Posts
    30
    Rep Power
    11

    Python assigning C/C++ f() ptrs


    I'm very new to python programming. I've hacked together a few things, that's about it.

    Here's my situation:

    I have a C module that has a python wrapper. (This is code that was given to me.) I've modified the C code to expose some external function pointers.

    I use C++ to implement the functions that these pointers point to.

    I need to use python to assign the C++ functions to the C function pointers.

    I've never really worked with three different programming languages like this before, so this is a little confusing for me.

    Thanks!
  2. #2
  3. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    Actually there should only only be one language in play here since functions in C and C++ are the same, so unless your using objects somewhere in the C++ part you're probably better off in standard C. (I may be missing something here though.)

    You might also want to ask this in the "C Programming" forum: http://forums.devshed.com/f42/s

    Edit: If you want to see what the C guys think of the problem I can move/copy this thread for you .

    As for assigning the pointer from within Python I don't think you can because the Python language doesn't support pointers/references directly you'll probably need to do this via the C API but I haven't played around with this yet .

    Have a good Xmas all,

    Mark.
    Last edited by netytan; December 24th, 2004 at 02:33 PM.
    programming language development: www.netytan.com Hula


IMN logo majestic logo threadwatch logo seochat tools logo