On 14-04-26 12:50 AM, Pavel Roschin wrote:
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 :(

e.g.
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:
Document_create_new_from_geany_document

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 :)


Is it possible that `GPointer` is a `PyCapsule` (or `PyCObject`) and not an actual `void*` pointing directly to a `GeanyDocument*`?

Cheers,
Matthew Brush

_______________________________________________
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel

Reply via email to