Asterisk source - C functions visibility/loader

I’m extending certain functionality to Asterisk, basically I’m spinning new Asterisk module and Dialplan “application”. I have a “linker” issue plaguing me which I cannot really figure out correctly:
I want to call a C function “foo” in module B which is defined in module A. B is a dialplan application in this case, but generally, in applies to any module.
So in module B I put the


header (among the other common headers). No additional header (.h) files. The project compiles and links without issues, but during module B loading I get error in loader.c:

Error loading module 'app_b': /usr/lib/asterisk/modules/ undefined symbol: foo.

Mind I was hammering this issue by mimicking the way other ast_ functions are done: I was even trying with res_pjsip_session source and header files, and just adding a function in .h file, like any other function there, also fails this way, which is completetly unfathomable for me why.

What the correct way of handling this issue - making functions “global”?

The depend XML is purely for menuselect. The module has to be defined as being global in order for symbols to be exported. You would also probably need an file which specifies what symbols are actually exported. The function also can’t be static of course.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.