Module development in C++ for Asterisk 13

Our company developed a module in C++ for asterisk for version 1.6. We want to upgrade the module to the latest version of Asterisk 13. The module (in C++) is compiled as dynamic library (*.so) and than is loaded by a code written in C we put in the res Asterisk source code directory. In our C++ code we include “asterisk.h” and other headers from Asterisk. The problem now is when we want to compile the C++ code for version 13 we get the

Looking in the asterisk header channel.h for the version 1.6 the definition of the structure is there, but for version 13 the definition of the structure ast_channel was moved to in main/channel_internal_api.c and that’s why I get these errors since in the channel.h there is only the forward declaration of the structure. How can I overcome this problem?

I was also the same problem.
The compiler message showed:

  1. “error: invalid use of incomplete type ‘struct ast_channel”

  2. …/asterisk-certified-13.13-cert6/include/asterisk/lock.h:103:8: error: forward declaration of ‘struct ast_channel’
    struct ast_channel;
    ^

BTW,
The dynamic library is loaded by modules.conf . The library file put in the Asterisk module directory.

Old: asterisk ver:1.8, g++:4.5.2 , OS: ubuntu 11.04
New: asterisk ver:13.13, g++:4.9.3 , OS: ubuntu 16.04

This is an end user forum. Please use the developer mailing list or IRC channels for developer questions.

Asterisk changed from using a simple shared data implementation of channels, to a C simulation of a property in an object oriented language. You must replace all direct references to channel structure fields with the corresponding get and set function calls.

Thank you for your reply.