[Geany-Devel] Python question

Pavel Roschin roshin at xxxxx
Sat Apr 26 07:50:15 UTC 2014

> It should be in the "current" library (not sure correct term), like if 
> it was C, you would call `dlopen(NULL, ...)`. I'm not familiar enough 
> with ctypes to say exactly but if it had a function like 
> `load_library()` I'd expect you would pass `None` where it expects a 
> filename. Alternatively, you might try `geany.document.__file__` to 
> pickup the C module's filename where the symbol lives, if that works.

It works great, now I can access to all internal geany binary functions. But I
can't access to geanypy.so functions :(

>>> lib.utils_remove_ext_from_filename
<_FuncPtr object at 0x27dc120>
>>> lib.Document_create_new_from_geany_document
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/usr/lib64/python2.7/ctypes/__init__.py", line 378, in __getattr__
    func = self.__getitem__(name)
  File "/usr/lib64/python2.7/ctypes/__init__.py", line 383, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: ./src/geany: undefined symbol:

I tried another way: using document_close from geany binary:

	def doc_close(self, doc):
		ptrValue = int(str(doc)[13:-1], 16)
		lib.document_close(ctypes.cast(ptrValue, ctypes.c_void_p).value)

Now I have segfault :)

Best regards,
Pavel Roschin aka RPG

More information about the Devel mailing list