On 12-05-28 02:24 PM, Thomas Martitz wrote:
Am 28.05.2012 13:27, schrieb Lex Trotman:
This doesn't actually call the C++ constructors/destructors in the way
they would be in normally be if the plugin had been statically linked.
This simply labels a C function to be called at dlopen time. It may
be used to do some initialisation, but you would have to manually call
each constructor, ... too error prone, Franks advice to create
everything dynamically is sound.
I meant to say that global/static constructors/destructors are in fact
called when a library is dlopened(), regardless of the language of
calling code.
I think that blurb in the newsletter was written before it was realized
that the whole C++ runtime/magic was already present because of
Scintilla. I wrote the paragraphs and IIRC Lex reviewed/revised it, but
I can say I'm probably the least qualified to write about how to use C++ :)
$ gcc -o libtestcpp.so -shared -fPIC test.cpp -g -lstdc++
-Wl,--no-undefined
$ ./test
Hello from Test
hello from extern C function
Bye from Test
FWIW, does anyone know why I needed to link libstdc++ explicitely in my
testing?
Just guessing but maybe it's because of using the `gcc` command instead
of `g++`? I only ever experienced needing to link to it explicitly with
Geany/Scintilla. In my own pure C++ code it's never needed.
Cheers,
Matthew Brush
_______________________________________________
Geany-devel mailing list
Geany-devel@uvena.de
https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel