<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Metrowerks compiler issue in Classic/Legacy CodeWarrior</title>
    <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Metrowerks-compiler-issue/m-p/159963#M2628</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;as the error is a compilation failure and not a link time failure, I doubt it is that issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would recommend to show a complete example and not just snippets, there is just too much undefined otherwise.&lt;/P&gt;&lt;P&gt;The text "void register﻿_callback ( (void (*)())(&amp;amp;call_stub&amp;lt;T&amp;gt;) ﻿)﻿" is not legal in C++ code as&amp;nbsp;&lt;/P&gt;&lt;P&gt;it is neither a declaration nor a statemen, seems to be some psedocode.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Either way only a concrete instance of the call_stub template function has an address (call_stub&amp;lt;int&amp;gt;), the address of call_stub&amp;lt;T&amp;gt;﻿ only makes sense if used inside of another template.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 18 Aug 2011 11:36:12 GMT</pubDate>
    <dc:creator>CompilerGuru</dc:creator>
    <dc:date>2011-08-18T11:36:12Z</dc:date>
    <item>
      <title>Metrowerks compiler issue</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Metrowerks-compiler-issue/m-p/159961#M2626</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV class="lia-message-body-content"&gt;&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 2 functions, both are identical except that one function is a template function. When I send the functions as function_pointer arguments to some other function, Metrowerks compiler complains for the template function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;template &amp;lt;typename T&amp;gt;&lt;BR /&gt;static void&lt;BR /&gt;call_stub (void *argument)&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...........&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ..............&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;static void&lt;BR /&gt;call_stub_ (void *argument)&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...........&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ..............&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;void register_callback ( (void (*)())(&amp;amp;call_stub&amp;lt;T&amp;gt;) )&amp;nbsp; ---- Gives error&lt;/P&gt;&lt;P&gt;void register_callback ( (void (*)())(&amp;amp;call_stub_) )&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ---- Works fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;Error Description:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Illegal explicit conversion from 'void' to 'void (*)()'.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Am I missing something here ? Is it a problem with the Metrowerks compiler ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using PowerPC EABI Linker. Version: Code Warrior PowerPC ISA, Release 8.5 Build 50425.&lt;/P&gt;&lt;P&gt;Thanks !!&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Aug 2011 16:11:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Metrowerks-compiler-issue/m-p/159961#M2626</guid>
      <dc:creator>cw_Potz</dc:creator>
      <dc:date>2011-08-17T16:11:15Z</dc:date>
    </item>
    <item>
      <title>Re: Metrowerks compiler issue</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Metrowerks-compiler-issue/m-p/159962#M2627</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I haven't used C++ in Codewarrior but a qualified guess is the classic problem with linking of template functions:&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.parashift.com/c++-faq-lite/templates.html#faq-35.12" rel="nofollow" target="_blank"&gt;http://www.parashift.com/c++-faq-lite/templates.html#faq-35.12&lt;/A&gt;﻿&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Whether Codewarrior supports export keyword or not, I have no idea.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Aug 2011 19:52:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Metrowerks-compiler-issue/m-p/159962#M2627</guid>
      <dc:creator>Lundin</dc:creator>
      <dc:date>2011-08-17T19:52:48Z</dc:date>
    </item>
    <item>
      <title>Re: Metrowerks compiler issue</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Metrowerks-compiler-issue/m-p/159963#M2628</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;as the error is a compilation failure and not a link time failure, I doubt it is that issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would recommend to show a complete example and not just snippets, there is just too much undefined otherwise.&lt;/P&gt;&lt;P&gt;The text "void register﻿_callback ( (void (*)())(&amp;amp;call_stub&amp;lt;T&amp;gt;) ﻿)﻿" is not legal in C++ code as&amp;nbsp;&lt;/P&gt;&lt;P&gt;it is neither a declaration nor a statemen, seems to be some psedocode.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Either way only a concrete instance of the call_stub template function has an address (call_stub&amp;lt;int&amp;gt;), the address of call_stub&amp;lt;T&amp;gt;﻿ only makes sense if used inside of another template.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Aug 2011 11:36:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Metrowerks-compiler-issue/m-p/159963#M2628</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2011-08-18T11:36:12Z</dc:date>
    </item>
    <item>
      <title>Re: Metrowerks compiler issue</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Metrowerks-compiler-issue/m-p/159964#M2629</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually the project on which I am working is quite a big one. So I just wrote the minimum stuff. Please check the code below, maybe better than previous time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks !!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;class MyThread&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; template &amp;lt;typename T&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; static void&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; call_stub (void *argument)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; static void&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; call_stub_ (void *argument)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&lt;BR /&gt;public:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; template &amp;lt;typename T&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MyThread (T &amp;amp;function,﻿ bool joinable = false)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; int result = register_callback ((void (*)())(&amp;amp;call_stub&amp;lt;T&amp;gt;), joinable, (void*)&amp;amp;function﻿);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; int result = register_callback ((void (*)())(&amp;amp;call_stub_), joinable, (void*)&amp;amp;function﻿);&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;};&lt;BR /&gt;&lt;BR /&gt;int&lt;BR /&gt;register_callback(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; void (*entryAddr)(void),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bool joinable,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; void *arg﻿&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // creates a thread and register the callback function.&lt;BR /&gt;}﻿&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Aug 2011 20:57:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Metrowerks-compiler-issue/m-p/159964#M2629</guid>
      <dc:creator>cw_Potz</dc:creator>
      <dc:date>2011-08-18T20:57:50Z</dc:date>
    </item>
  </channel>
</rss>

