<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi,<br>
    <br>
    You are right, the 1.6.2 branch is on end of life, but our
    configuration is for 1.6.2.<br>
    I checked some source code from the version 1.6.2.22 (especially the
    func_cdr and func_odb), in witch i saw that the ast_custom_function
    is used in this format:<br>
    static struct ast_custom_function cdr_function = {<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .name = "CDR",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .read = cdr_read,&nbsp;&nbsp;&nbsp; <br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .write = cdr_write,<br>
    };<br>
    But when i tried in my code,
    <meta http-equiv="content-type" content="text/html;
      charset=ISO-8859-1">
    <span id="result_box" class="short_text" lang="en"><span class="hps">I
        got</span> <span class="hps">these errors at compile time:<br>
        func/FuncStartCall.cpp:48: error: expected primary-expression
        before &#8216;.&#8217; token<br>
        func/FuncStartCall.cpp:48: error: expected primary-expression
        before &#8216;.&#8217; token<br>
        func/FuncStartCall.cpp:48: error: expected primary-expression
        before &#8216;.&#8217; token<br>
        func/FuncStartCall.cpp:48: error: uninitialized const member
        &#8216;ast_custom_function::desc&#8217;<br>
        func/FuncStartCall.cpp:48: error: uninitialized const member
        &#8216;ast_custom_function::syntax&#8217;<br>
        func/FuncStartCall.cpp:48: error: uninitialized const member
        &#8216;ast_custom_function::arguments&#8217;<br>
        func/FuncStartCall.cpp:48: error: uninitialized const member
        &#8216;ast_custom_function::seealso&#8217;<br>
        <br>
        Maybe I need to add some compiler option, or there some minimum
        version in gcc to use this format of value assignment? <br>
        <br>
        Regards<br>
      </span></span><br>
    On 1/31/12 7:40 PM, <a class="moz-txt-link-abbreviated" href="mailto:asterisk-dev-request@lists.digium.com">asterisk-dev-request@lists.digium.com</a> wrote:
    <blockquote
      cite="mid:mailman.28099.1328031635.2715.asterisk-dev@lists.digium.com"
      type="cite">
      <pre wrap=""><a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="mailto:szasz.tamas@elastoffice.com">&lt;szasz.tamas@elastoffice.com&gt;</a> wrote:
</pre>
      <blockquote type="cite" style="color: #000000;">
        <pre wrap=""><span class="moz-txt-citetags">&gt; </span>I'm new in asterisk development, and I need to change something in our
<span class="moz-txt-citetags">&gt; </span>module, because the module was developed for asterisk 1.4.
<span class="moz-txt-citetags">&gt; </span>The problem from where I can't move out:
<span class="moz-txt-citetags">&gt; </span>In our old 1.4 module was a definition:
<span class="moz-txt-citetags">&gt; </span>FUNCTION_STATIC(Function, funcName, synopsis, syntax, description)
<span class="moz-txt-citetags">&gt; </span>??????????????????????????????? Function * Function::_instance = 0;
<span class="moz-txt-citetags">&gt; </span>??????????????????????????????? struct ast_custom_function
<span class="moz-txt-citetags">&gt; </span>Function::function =
<span class="moz-txt-citetags">&gt; </span>??????????????????????????????? {
<span class="moz-txt-citetags">&gt; </span>??? ??? ??? ??? ??? ??? ??? ??? ??? ??? funcName,? //const char *
<span class="moz-txt-citetags">&gt; </span>??? ??? ??? ??? ??? ??? ??? ??? ??? ??? synopsis, ? //const char *
<span class="moz-txt-citetags">&gt; </span>??? ??? ??? ??? ??? ??? ??? ??? ??? ??? syntax, ? //const char *
<span class="moz-txt-citetags">&gt; </span>??? ??? ??? ??? ??? ??? ??? ??? ??? ??? description, ? //const char *
<span class="moz-txt-citetags">&gt; </span>??? ??? ??? ??? ??? ??? ??? ??? ??? ??? FuncReadWrapper&lt;Function&gt;,
<span class="moz-txt-citetags">&gt; </span>??? ??? ??? ??? ??? ??? ??? ??? ??? ??? FuncWriteWrapper&lt;Function&gt;
<span class="moz-txt-citetags">&gt; </span>??? ??? ??? ??? ??? ??? ??? ??? };
<span class="moz-txt-citetags">&gt;</span>
<span class="moz-txt-citetags">&gt; </span>But in the asterisk version 1.6 we must use the ast_custom_function like
<span class="moz-txt-citetags">&gt; </span>this:
<span class="moz-txt-citetags">&gt;</span>
<span class="moz-txt-citetags">&gt; </span>struct ast_custom_function {
<span class="moz-txt-citetags">&gt; </span>??????? const char *name;?????????????????????? /*!&lt; Name */
<span class="moz-txt-citetags">&gt; </span>??????? AST_DECLARE_STRING_FIELDS(
<span class="moz-txt-citetags">&gt; </span>??????????????? AST_STRING_FIELD(synopsis);???? /*!&lt; Synopsis text for 'show
<span class="moz-txt-citetags">&gt; </span>functions' */
<span class="moz-txt-citetags">&gt; </span>??????????????? AST_STRING_FIELD(desc);???????? /*!&lt; Description (help text)
<span class="moz-txt-citetags">&gt; </span>for 'show functions &amp;lt;name&amp;gt;' */
<span class="moz-txt-citetags">&gt; </span>??????????????? AST_STRING_FIELD(syntax);?????? /*!&lt; Syntax text for 'core
<span class="moz-txt-citetags">&gt; </span>show functions' */
<span class="moz-txt-citetags">&gt; </span>??????????????? AST_STRING_FIELD(arguments);??? /*!&lt; Arguments description
<span class="moz-txt-citetags">&gt; </span>*/
<span class="moz-txt-citetags">&gt; </span>??????????????? AST_STRING_FIELD(seealso);????? /*!&lt; See also */
<span class="moz-txt-citetags">&gt; </span>??????? );
<span class="moz-txt-citetags">&gt; </span>??????? enum ast_doc_src docsrc;??????????????? /*!&lt; Where the documentation
<span class="moz-txt-citetags">&gt; </span>come from */
<span class="moz-txt-citetags">&gt; </span>??????? ast_acf_read_fn_t read;???????? /*!&lt; Read function, if read is
<span class="moz-txt-citetags">&gt; </span>supported */
<span class="moz-txt-citetags">&gt; </span>??????? ast_acf_write_fn_t write;?????? /*!&lt; Write function, if write is
<span class="moz-txt-citetags">&gt; </span>supported */
<span class="moz-txt-citetags">&gt; </span>??????? struct ast_module *mod;???????? /*!&lt; Module this custom function
<span class="moz-txt-citetags">&gt; </span>belongs to */
<span class="moz-txt-citetags">&gt; </span>??????? AST_RWLIST_ENTRY(ast_custom_function) acflist;
<span class="moz-txt-citetags">&gt; </span>};
<span class="moz-txt-citetags">&gt;</span>
<span class="moz-txt-citetags">&gt; </span>Can somebody explain me, how can I change my code to the new style. I tried
<span class="moz-txt-citetags">&gt; </span>it, but neither one solution worked.
<span class="moz-txt-citetags">&gt; </span>Maybe for a senior developer, it's a simple question.
</pre>
      </blockquote>
      <pre wrap="">First of all, there is no version 1.6.  There's 1.6.0, 1.6.1, and
1.6.2, which are all separate branches, and additionally, all of which
are obsolete.  You should probably be using 1.8 for all new code at
this point.

The major change is that documentation is now created in XML format
and embedded within the source file, extracted at compile time, and
instantiated at runtime.  Unless you are creating dynamic functions
like func_odbc does, there is no need to ever access the stringfields
in the ast_custom_function structure.  And that's also the key module
if you are creating dynamic functions -- func_odbc.c shows all of the
necessary API calls to populate those stringfields.

-Tilghman

</pre>
    </blockquote>
    <br>
  </body>
</html>