[Bro-Dev] Opaque type in plugin

Jan Grashöfer jan.grashoefer at gmail.com
Mon May 2 10:01:34 PDT 2016


>> that I initialized in place. This went well and the new opaque value
>> seems to behave as expected. However, I wonder if I am missing anything
>> that might cause problems?
> 
> Mind sharing your code (both before/after the change, and also the
> error message you got)?

Sure. The code is available at
https://github.com/J-Gras/bro-plugins/tree/topic/jgras/liblognorm/liblognorm.
Unfortunately I don't have commits for both versions but the changes are
minimal. The relevant files are src/LogNormalizer*.

Currently LogNormalizer.cc:11 declares the type using static. That seems
to work (as it is local). If I remove "static" and use the "extern"
declaration commented in LogNormalizer.h:78 (like its done in Bro),
loading the plugin fails with:
fatal error in /home/jgras/devel/bro/scripts/base/init-bare.bro, line 1:
cannot load plugin library
/home/jgras/devel/bro/aux/plugins/liblognorm/build//lib/Bro-Lognorm.linux-x86_64.so:
/home/jgras/devel/bro/aux/plugins/liblognorm/build//lib/Bro-Lognorm.linux-x86_64.so:
undefined symbol: _ZN6plugin11Bro_Lognorm18lognormalizer_typeE

>From what I understand this is expected as a dynamically linked global
variable would need special treatment. But as I am not used to C++ and
my understanding of Bro's type system is limited, I am not sure I missed
important details in my solution.

Best regards,
Jan


More information about the bro-dev mailing list