ctypes - python2.7.3 vs python3.2.3

John Gordon gordon at panix.com
Tue Aug 28 17:51:05 EDT 2012


In <18eb8025-7545-4d10-9e76-2e41deaadb69 at googlegroups.com> Rolf <rolfb at personalized-books.com> writes:

> uint32_t myfunction (char ** _mydata)
> {
>    char mydata[16];

>    strcpy(mydata, "Hello Dude!");

>    *_mydata = mydata;

>    return 0;
> }

mydata is an auto variable, which goes out of scope when myfunction()
exits.  *_mydata ends up pointing to garbage.

-- 
John Gordon                   A is for Amy, who fell down the stairs
gordon at panix.com              B is for Basil, assaulted by bears
                                -- Edward Gorey, "The Gashlycrumb Tinies"




More information about the Python-list mailing list