Hello, I would like to work with some data using python/numpy. The data is generated with C. To bring the data from C to python, I would like to use ctype. I am using python 2.4.3 on a windows-System.
To accomplish the described task, I have the following plan. Please tell me, if this is possible, respectively if there is a better way. 1) In C, I write a .dll, that has a function int foo(PyObject *arg) 2) In python, I generate a numpy-array with the appropriate size. e.g. a = zeros((3,3), dtype=int) 3) From python, I call my .dll-function with a as an argument: windll.mydll.foo(a) 4) In the foo-function in the C-.dll I cast the pointer and access the data-field. PyArrayObject *myPtr = (PyArrayObject*) arg; myPtr->data[0] = 1; return 0; However, when I do this, I get an "AccessViolationError writing 0x000000000" What can I do about it? Thank you for every comment Lars -- Dipl.-Ing. Lars Friedrich Optical Measurement Technology Department of Microsystems Engineering -- IMTEK University of Freiburg Georges-Köhler-Allee 102 D-79110 Freiburg Germany phone: +49-761-203-7531 fax: +49-761-203-7537 room: 01 088 email: [EMAIL PROTECTED] ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion