On 8/28/12 23:51 , John Gordon wrote:
In <18eb8025-7545-4d10-9e76-2e41deaad...@googlegroups.com> Rolf 
<ro...@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.


I'm not completely sure, but i think this can be solved by using:

    static char mydata[16];

(Btw.: I don't know why you use char ** _mydata, i would use
       char * _mydata, but then again, i'm not very familiar with
       ctypes)

Jan Kuiken

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to