[Geany-devel] Geany Newsletter Issue #5

Frank Lanitz frank at xxxxx
Mon May 28 18:39:16 UTC 2012


Am 28.05.2012 13:27, schrieb Lex Trotman:
> On 28 May 2012 19:59, Thomas Martitz
> <thomas.martitz at student.htw-berlin.de> wrote:
>> Am 28.05.2012 11:27, schrieb Frank Lanitz:
>>>
>>> It's important to note that the dynamic library loading mechanism
>>> that loads plugins is C functionality and does not know about C++
>>> constructors. This means that global and static objects in the
>>> plugin will *not* have their constructors called when the plugin is
>>> loaded. Use dynamically created objects as show in the above example.
>>>
>>
>> I'm not sure this is true. libdl should handle this (i.e. call functions
>> point to in the init and fini sections).
>>
>> |__attribute__ ((constructor)) and||__attribute__  ((destructor)) is
>> supported works with as well.
>>
> 
> 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.

It's not mine, as I really don't have a clue about this section. Content
was introduced by a patch IIRC by Matthew and you ;)

Cheers,
Frank

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 900 bytes
Desc: OpenPGP digital signature
URL: <http://lists.geany.org/pipermail/devel/attachments/20120528/dad982ac/attachment.pgp>


More information about the Devel mailing list