Running C++ Applications with Asterisk

Hi
We are trying to compile a c++ application with Asterisk. We got to the point where naming our C++ application file as .cc makes the Asterisk compile it using g++ compiler. However, when the file is getting compiled, the code is giving error related to AST_MODULE_INFO_STANDARD. We checked up inside module.h and are trying to make some modifications there to make the g++ compiler accept the application.

However, I wanted to know whether this is a known problem. Do people develop C++ applications for use with Asterisk? And if so, how is it done?

Thanks for the help.

Regards
Harshat

Hi
We could proceed a bit further and were able to compile the gcc file by making some changes in module.h inside the part of ifdef C_PLUS_PLUS …

Now we tried to actually introcude some C++ code inside this .CC file that had only C code till now. We just included iostream but we got many errors. We found that asterisk has changed p_thread - "use_ast_mutex_lock_instead_of_pthread_mutex_lock’ ". We also used the ifdef CYGWIN to get over this but it still gives us some errors (reduced from the first time). I am posting the error received.

make CXX_CFLAGS="-D__CYGWIN__“
CC=“cc” CXX=”/usr/bin/g++" LD="" AR="" RANLIB="" CFLAGS="" make -C menuselect CONFIGURE_SILENT="–silent" makeopts
make[1]: Entering directory /hm/skumar/telephonePbxServerAsterisk/asterisk-1.6.1.4/menuselect' make[1]:makeopts’ is up to date.
make[1]: Leaving directory /hm/skumar/telephonePbxServerAsterisk/asterisk-1.6.1.4/menuselect' menuselect/menuselect --check-deps menuselect.makeopts Generating embedded module rules ... [CXX] app_CaptureAudio.cc -> app_CaptureAudio.oo In file included from /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../include/c++/3.4.6/i386-redhat-linux/bits/gthr.h:104, from /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../include/c++/3.4.6/i386-redhat-linux/bits/c++io.h:37, from /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../include/c++/3.4.6/iosfwd:47, from /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../include/c++/3.4.6/bits/stl_algobase.h:70, from /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../include/c++/3.4.6/vector:67, from app_CaptureAudio.cc:37: /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../include/c++/3.4.6/i386-redhat-linux/bits/gthr-default.h:75: error:use_ast_mutex_lock_instead_of_pthread_mutex_lock’ was not declared in this scope
/usr/lib/gcc/i386-redhat-linux/3.4.6/…/…/…/…/include/c++/3.4.6/i386-redhat-linux/bits/gthr-default.h:76: error: use_ast_mutex_trylock_instead_of_pthread_mutex_trylock' was not declared in this scope /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../include/c++/3.4.6/i386-redhat-linux/bits/gthr-default.h:77: error:use_ast_mutex_unlock_instead_of_pthread_mutex_unlock’ was not declared in this scope
/usr/lib/gcc/i386-redhat-linux/3.4.6/…/…/…/…/include/c++/3.4.6/i386-redhat-linux/bits/gthr-default.h:82: error: use_ast_mutex_init_instead_of_pthread_mutex_init' was not declared in this scope /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../include/c++/3.4.6/i386-redhat-linux/bits/gthr-default.h: In functionint __gthread_mutex_lock(__gthread_mutex_t*)’:
/usr/lib/gcc/i386-redhat-linux/3.4.6/…/…/…/…/include/c++/3.4.6/i386-redhat-linux/bits/gthr-default.h:599: error: __gthrw_pthread_mutex_lock' cannot be used as a function /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../include/c++/3.4.6/i386-redhat-linux/bits/gthr-default.h: In functionint __gthread_mutex_trylock(__gthread_mutex_t*)’:
/usr/lib/gcc/i386-redhat-linux/3.4.6/…/…/…/…/include/c++/3.4.6/i386-redhat-linux/bits/gthr-default.h:608: error: __gthrw_pthread_mutex_trylock' cannot be used as a function /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../include/c++/3.4.6/i386-redhat-linux/bits/gthr-default.h: In functionint __gthread_mutex_unlock(__gthread_mutex_t*)’:
/usr/lib/gcc/i386-redhat-linux/3.4.6/…/…/…/…/include/c++/3.4.6/i386-redhat-linux/bits/gthr-default.h:617: error: `__gthrw_pthread_mutex_unlock’ cannot be used as a function
app_CaptureAudio.cc: At global scope: