<?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: Newbie trying to use pthreads in Classic/Legacy CodeWarrior</title>
    <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Newbie-trying-to-use-pthreads/m-p/139451#M1221</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;mphillips wrote:&lt;BR /&gt;&amp;gt;&amp;gt;I'm not quite sure about the relation of Visual C++ to Win32 and Windows XP&lt;BR /&gt;&lt;BR /&gt;Most open source, freeware and commercial stuff for windoze is made with MS tools&lt;BR /&gt;like VC++6, VS2005 and so on. If you find codes on the web for Win32, they will (most&lt;BR /&gt;likely) compile with MS tools, but one must modify something to compile them with GCC, CW, etc.&lt;BR /&gt;&lt;BR /&gt;mphillips wrote:&lt;BR /&gt;&amp;gt;&amp;gt;the pthreads library I downloaded is the Win32 version and I'm running CW on Windows XP.&lt;BR /&gt;&amp;gt;&amp;gt;Given this, is it still likely that there's an OS incompatibility?&lt;BR /&gt;&lt;BR /&gt;No, it's a compiler incompatibility. MS compilers use '__declspec(dllimport)' to tell the compiler and linker that a function resides in a DLL. I don't know what CW for Win32 uses to do the same thing.&lt;BR /&gt;&lt;BR /&gt;BTW: In my opinion, the PThread library is only necessary if you write multithreading-aware programs that must be portable across UNIX-like systems. Under Windows you can use WinApi functions like 'CreateThread'...&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;-&amp;gt; pittbull&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 09 Dec 2006 07:30:31 GMT</pubDate>
    <dc:creator>pittbull</dc:creator>
    <dc:date>2006-12-09T07:30:31Z</dc:date>
    <item>
      <title>Newbie trying to use pthreads</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Newbie-trying-to-use-pthreads/m-p/139448#M1218</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Some of this may apply to using any user-supplied library and some of this may be particular to pthreads (&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://sourceware.org/pthreads-win32/" target="_blank"&gt;http://sourceware.org/pthreads-win32/&lt;/A&gt;&lt;SPAN&gt;). Anyway, I'm trying to test out some sample pthreads code in CodeWarrior, and here's what happened:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) I put the pthreads folder in the main CodeWarrior directory and #include in the header. When I tried to compile, I got errors like&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error : Undefined symbol: '__declspec(dllimport) _pthread_mutex_lock (__imp__pthread_mutex_lock)'&lt;BR /&gt;referenced from '_thread_function' in pthread_ex.c:12&lt;BR /&gt;referenced from '_main' in pthread_ex.c:31&lt;BR /&gt;pthread_ex.c line 12&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2) I added pthread.c to the project (Project -&amp;gt; Add files). Then I got this error, followed by many errors relating to undefined data types, etc.:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error : the file 'timeb.h' cannot be opened&lt;BR /&gt;(included from:&lt;BR /&gt;private.c:55&lt;BR /&gt;pthread.c:44)&lt;BR /&gt;ptw32_relmillisecs.c line 43 #include timeb.h&amp;gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3) So, I added timeb.h and cdefs.h from &lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.koders.com%2F" rel="nofollow" target="_blank"&gt;www.koders.com&lt;/A&gt;, and put these files in the 'sys' folder. The syntax errors relating to time structures remained, e.g.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error : ';' expected&lt;BR /&gt;(included from:&lt;BR /&gt;private.c:55&lt;BR /&gt;pthread.c:44)&lt;BR /&gt;ptw32_relmillisecs.c line 50 const int64_t NANOSEC_PER_MILLISEC = 1000000;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error : expression syntax error&lt;BR /&gt;(included from:&lt;BR /&gt;private.c:55&lt;BR /&gt;pthread.c:44)&lt;BR /&gt;ptw32_relmillisecs.c line 51 const int64_t MILLISEC_PER_SEC = 1000;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error : expression syntax error&lt;BR /&gt;(included from:&lt;BR /&gt;private.c:55&lt;BR /&gt;pthread.c:44)&lt;BR /&gt;ptw32_relmillisecs.c line 52 DWORD milliseconds;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;********************************************************************************&lt;BR /&gt;So, I'd be extremely grateful if anyone could shed some light on what's going on here for me. Are there more files I need to add? Have I accessed the pthreads library inappropriately? Thank you for your consideration--&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&lt;BR /&gt;Matt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Dec 2006 22:16:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Newbie-trying-to-use-pthreads/m-p/139448#M1218</guid>
      <dc:creator>mphillips</dc:creator>
      <dc:date>2006-12-08T22:16:23Z</dc:date>
    </item>
    <item>
      <title>Re: Newbie trying to use pthreads</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Newbie-trying-to-use-pthreads/m-p/139449#M1219</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hi,&lt;BR /&gt;The Pthreads lib you try to use seems to be made for MS Visual C++.&lt;BR /&gt;The '__declspec(dllimport)' is a MS-specific extensions to the C language.&lt;BR /&gt;I don't think there's a CW version of Pthreads, so you must port it yourself (Can't be that much difficult).&lt;BR /&gt;&lt;BR /&gt;Anyway, Pthreads needs an underlying operating system that supports&lt;BR /&gt;native threading (But I think you already know that)...&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;-&amp;gt; pittbull&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Dec 2006 23:13:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Newbie-trying-to-use-pthreads/m-p/139449#M1219</guid>
      <dc:creator>pittbull</dc:creator>
      <dc:date>2006-12-08T23:13:29Z</dc:date>
    </item>
    <item>
      <title>Re: Newbie trying to use pthreads</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Newbie-trying-to-use-pthreads/m-p/139450#M1220</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BR /&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;pittbull wrote:&lt;BR /&gt;Hi,&lt;BR /&gt;The Pthreads lib you try to use seems to be made for MS Visual C++.&lt;BR /&gt;The '__declspec(dllimport)' is a MS-specific extensions to the C language.&lt;BR /&gt;I don't think there's a CW version of Pthreads, so you must port it yourself (Can't be that much difficult).&lt;BR /&gt;&lt;BR /&gt;Anyway, Pthreads needs an underlying operating system that supports&lt;BR /&gt;native threading (But I think you already know that)...&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;-&amp;gt; pittbull&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks for your response to my query. I'm not quite sure about the relation of Visual C++ to Win32 and Windows XP, but in any case, the pthreads library I downloaded is the Win32 version and I'm running CW on Windows XP. Given this, is it still likely that there's an OS incompatibility? I've never ported anything before--do you have a favorite online tutorial for how to do this? Thanks--&lt;BR /&gt;&lt;BR /&gt;Best,&lt;BR /&gt;Matt&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 09 Dec 2006 05:08:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Newbie-trying-to-use-pthreads/m-p/139450#M1220</guid>
      <dc:creator>mphillips</dc:creator>
      <dc:date>2006-12-09T05:08:56Z</dc:date>
    </item>
    <item>
      <title>Re: Newbie trying to use pthreads</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Newbie-trying-to-use-pthreads/m-p/139451#M1221</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;mphillips wrote:&lt;BR /&gt;&amp;gt;&amp;gt;I'm not quite sure about the relation of Visual C++ to Win32 and Windows XP&lt;BR /&gt;&lt;BR /&gt;Most open source, freeware and commercial stuff for windoze is made with MS tools&lt;BR /&gt;like VC++6, VS2005 and so on. If you find codes on the web for Win32, they will (most&lt;BR /&gt;likely) compile with MS tools, but one must modify something to compile them with GCC, CW, etc.&lt;BR /&gt;&lt;BR /&gt;mphillips wrote:&lt;BR /&gt;&amp;gt;&amp;gt;the pthreads library I downloaded is the Win32 version and I'm running CW on Windows XP.&lt;BR /&gt;&amp;gt;&amp;gt;Given this, is it still likely that there's an OS incompatibility?&lt;BR /&gt;&lt;BR /&gt;No, it's a compiler incompatibility. MS compilers use '__declspec(dllimport)' to tell the compiler and linker that a function resides in a DLL. I don't know what CW for Win32 uses to do the same thing.&lt;BR /&gt;&lt;BR /&gt;BTW: In my opinion, the PThread library is only necessary if you write multithreading-aware programs that must be portable across UNIX-like systems. Under Windows you can use WinApi functions like 'CreateThread'...&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;-&amp;gt; pittbull&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 09 Dec 2006 07:30:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Newbie-trying-to-use-pthreads/m-p/139451#M1221</guid>
      <dc:creator>pittbull</dc:creator>
      <dc:date>2006-12-09T07:30:31Z</dc:date>
    </item>
  </channel>
</rss>

