Le 26/04/2014 22:48, Lex Trotman a écrit :
On 27 April 2014 03:43, Pavel Roschin roshin@scriptumplus.ru wrote:
Another (untested) hack that might work:
def geanypy_path(): import geany, os path = os.path.dirname( os.path.dirname(os.path.dirname(geany.__file__))) return os.path.join(path, "geanypy.so")
Cheers, Matthew Brush
It works good too, but as I mentioned above, casting doc to correct pointer isn't simple in Python (and I have no ideas how to).
You have to define a structure type that matches what the pointer points to https://docs.python.org/2/library/ctypes.html#structures-and-unions and then cast the doc pointer to that https://docs.python.org/2/library/ctypes.html#type-conversions and then you should be able to access the fields.
…or just write C for 5 minutes instead of fighting Python for 5 days :)