[asterisk-dev] Compiling a c++ function module

Kevin P. Fleming kpfleming at digium.com
Wed Sep 15 08:02:40 CDT 2010


On 09/15/2010 07:46 AM, Andre Courchesne wrote:
> Hi all,
> 
>   I am attempting to build a function module based on func_volume. However I need to link to a static library and include a header file that c++ syntax (class definition,...). So I attempt to compile my module with g++. 
> 
>   I'm working my way through the compile errors (mostly syntax related), but one got me stumped:
> 
> func_testfoo.c:81: error: expected primary-expression before ‘.’ token
> func_testfoo.c:82: error: expected primary-expression before ‘.’ token
> 
> The code segment related is:
> 
> /*! \brief Static structure for datastore information */
> static const struct ast_datastore_info volume_datastore = {
>         .type = "volume",
>         .destroy = destroy_callback
> };
> 
>   Any hints ?
> 
>   If anyone as a similar function module skeleton that would compile with g++ I would be grateful.

Named initializer syntax for structures is not supported in C++. You'll
have to use array-style initialization.

-- 
Kevin P. Fleming
Digium, Inc. | Director of Software Technologies
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
skype: kpfleming | jabber: kfleming at digium.com
Check us out at www.digium.com & www.asterisk.org



More information about the asterisk-dev mailing list