[Freeswitch-dev] C or C++ Development for Freeswitch Modules

I put the Who? in Mishehu mishehu at freeswitch.org
Thu Mar 6 03:30:24 MSK 2014


My recommendation is just to use those parts of C++ that make sense to 
use.  In any modules that I've ever worked on that were in C++, I 
avoided using exceptions, for example.  You can allocate new C++ objects 
onto memory pools in FS (see the SwitchToMempool class in switch_cpp.h), 
but when you destroy the memory pools, you will need to explicitly call 
up a dtor on the objects if you have any further cleanup that you need 
to do at that point.  If you inherit from this class, it will *not*, 
however, implicitly overload new for any type of member objects that you 
may need to new.

-Yossi

On 03/04/2014 08:36 PM, Aaron Scott wrote:
> Hi All,
>
> I am working on a module for Freeswitch which could benefit from C++.  I
> have written modules before in C++ and didn't find any particular
> problem.  However, I can't help but notice that the majority of the
> modules that come with Freeswitch are written in C. Is there a
> compelling reason to choose C over C++ for Freeswitch module
> development?  I realise that C can produce more efficient binaries and
> is better suited for low latency tasks but are there any reasons aside
> from this?
>
> Kind Regards,
>
> Aaron
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> 
> 
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-dev mailing list
> FreeSWITCH-dev at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
> http://www.freeswitch.org




Join us at ClueCon 2013 Aug 6-8, 2013
More information about the FreeSWITCH-dev mailing list