[C++-sig] Boost::Python for C code -> Segmentation fault

thor.arne.johansen at ibas.no thor.arne.johansen at ibas.no
Thu Jul 22 20:56:03 CEST 2004



>typedef struct user {
>   char *name;
>   int number;
>}user;
>
>void greet(user *u)
>{
>    printf("Hello %s, your number is %d.\n"
>           , u->name, u->number);
>}


You never allocate (or initilialize) the memory for user, so your printf
runs wild in memory.

--
Thor Arne Johansen
Dept. Manager R&D
Ibas AS




More information about the Cplusplus-sig mailing list