[Pyrex] Pyrex questions
Simon Burton
simon at arrowtheory.com
Tue Jun 1 18:11:53 CEST 2004
On Tue, 01 Jun 2004 16:56:06 +1000
Tom Kobialka <u3356514 at anu.edu.au> wrote:
> Hi Simon,
>
> Yes, I would have assumed this is implied, but I should have been more
> specific. I'm trying to encapsulate a C program *in python* with the aid
> of Pyrex.
>
My fault - I'm not sure what you are meaning by "encapsulate".
I'm guessing you want to call functions in this C program from python.
But you also want to call your grav library from python ?
This is often called "wrapping" :)
>
> I am encapsulating a small C program that makes use of a very specific
> gravitational wave frame library. I want to call the routines in the
> library from my C program. Do I have to encapsulate the library in Pyrex
> in order to call it from my encapsulated C program? Reading through the
> Pyrex documentation I get the feeling that I will. This library is of a
> reasonable size and i'm not looking forward to encapsulating it. Could I
> get away with only encapsulating the routines that my program calls? If
> so, do I need to take into account other routines that these routines
> may call?
You only need to write definitions (etc.) for the functions you will be calling.
> I have read through the Pyrex doco and it doesn't seem to mention C
> routines and procedures such as atoi, malloc, opendir (dirent.h),
> casting or nesting i.e monkey = (char *) malloc(strlen(banana) +
> strlen(paddlepop->chocolate)) which a large proportion of my code
> involves.
Yes, you can use these functions from pyrex code too (just write definitions for them).
Oh, hey, you are just around the corner from me, maybe I should just come over!! haha ..
Simon.
--
Simon Burton, B.Sc.
Licensed PO Box 8066
ANU Canberra 2601
Australia
Ph. 61 02 6249 6940
http://arrowtheory.com
More information about the Pyrex
mailing list