<br><br><div><span class="gmail_quote">On 25/03/2008, <b class="gmail_sendername">Gabriel Genellina</b> <<a href="mailto:gagsl-py2@yahoo.com.ar">gagsl-py2@yahoo.com.ar</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
En Mon, 24 Mar 2008 19:56:08 -0300, Nathan Harmston<br> <<a href="mailto:iwanttobeabadger@googlemail.com">iwanttobeabadger@googlemail.com</a>> escribió:<br> <br><br> > import ctypes<br> > t = ctypes.CDLL('./Simulation.so')<br>
 > this works fine, I have a simple function I ve put in for testing which<br> > just<br> > returns the integer 4. However when I try to access this function it<br> > doesnt<br> > work<br> > t.test()<br>
 >  File "<stdin>", line 1, in <module><br> >   File<br> > "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ctypes/__init__.py",<br> > line 325, in __getattr__<br>
 >     func = self.__getitem__(name)<br> >   File<br> > "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ctypes/__init__.py",<br> > line 330, in __getitem__<br> >     func = self._FuncPtr((name_or_ordinal, self))<br>
 > AttributeError: dlsym(0x81e6b0, test): symbol not found<br> <br> <br>Looks like the symbol isn't public - probably if you try loading the<br> library with a C program it won't find it either. How is the function<br>
 declared in the source?<br> Try listing all public symbols with: nm -D Simulation.so</blockquote><div>Thanks for the quick reply: <br>Running nm lists test as <br>00001760 T _test<br><br>in the source its declared as:<br>
 <br>int test(){<br>    return 4;    <br>}<br><br>Sorry, this is the first time I'm making my own shared library and using ctypes, so being a little slow. <br><br>Thanks again <br><br>Nathan<br><br><br><br><br></div><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> > Im hoping python-list is ok for questions regarding ctypes :S<br> <br> <br>It's not off topic, although there is a specific list for ctypes-related<br>
 questions. But hijacking a thread to post a completely different question<br> is not good netiquette.<br> <br> --<br> Gabriel Genellina<br> <br><br> --<br> <a href="http://mail.python.org/mailman/listinfo/python-list">http://mail.python.org/mailman/listinfo/python-list</a><br>
 </blockquote></div><br>