Friday, November 18, 2016

Re: [Discuss-gnuradio] CMake Linking Problem

Hi Devin,

in include/my_mod/api.h you'll find a #define like this

#define MY_MOD_API __STUFF

use MY_MOD_API in front of the classes and free-standing functions you want to export, like

uint32_t MY_MOD_API crc32(unsigned int, void const*, unsigned long);

Best regards,
Marcus

PS: having written your own CRC is cool, but you can probably use one of the many existing implementations!


On 18.11.2016 17:15, devin kelly wrote:
Hello,

I've created my own GR module with GR mod tool.  I added two files

   include/my_mod/crc.h
   lib/crc.cc

And I can use the functions (crc32 for example) in those files perfectly fine within classes that wind up in libgnuradio-my_mod.so.  However, I can't use the functions in crc.h/crc.cc in external applications that link to libgnuradio-my_mod.so. 

The correct symbols exist in libgnuradio-my_mod.so however the symbols are local, not global.

$ readelf -a lib/libgnuradio-my_mod.so | grep crc32
   192: 0000000000228440  1024 OBJECT  LOCAL  DEFAULT   24 crc32_tab
   426: 000000000000f3f0    52 FUNC    LOCAL  DEFAULT   11 _Z5crc32jPKvm

How can I expose crc32 to the outside world?  Do I have to make the change in one of my CMakeLists.txt files or one of the source files?  The function (crc32) isn't a static.

Thanks for any help,
Devin


_______________________________________________  Discuss-gnuradio mailing list  Discuss-gnuradio@gnu.org  https://lists.gnu.org/mailman/listinfo/discuss-gnuradio  

No comments:

Post a Comment