bug-commoncpp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Cplusplus-devel]RE: using the CommonC++ library in WIN32


From: David Sugar
Subject: Re: [Cplusplus-devel]RE: using the CommonC++ library in WIN32
Date: Wed, 16 May 2001 00:01:59 -0400
User-agent: Mozilla/5.0 (X11; U; Linux 2.2.16-9mdk i686; en-US; m18) Gecko/20001013

That is interesting, since waitThread (and the others) are initially defined
in line 95 with __EXPORT, or do all references then also require it?  That
would explain those warning.  I would love to have someone dedicated to the
win32 platform support on a regular basis.

Charles Hwu ( 胡嚴之 ) wrote:

> Hi Massimo,
> 
> Change Thread.h line 486 from
>         friend DWORD waitThread(HANDLE hRef, timeout_t timeout);
>                         to
>         friend DWORD __EXPORT waitThread(HANDLE hRef, timeout_t timeout);
> Change Thread.h line 487 from
>         friend DWORD waitThread(HANDLE hRef, timeout_t timeout);
>                         to
>         friend DWORD __EXPORT waitThread(HANDLE hRef, timeout_t timeout);
>                         .
>                         .
>         In MSVC, the friend declaration must have the "extract" type.
> 
>         I have used the CommonC++ for linux solaris and win32.
>         And source program port each other.
>         This is a good Library!
>         Thank David Sugar!!.
> 
> If there are more problem in Win32 Platform.Maybe we can share our 
> experience.
> 
> -----Original Message-----
> From: David Sugar [mailto:address@hidden
> Sent: Wednesday, May 16, 2001 8:43 AM
> To: Massimo Balestri
> Cc: address@hidden; address@hidden
> Subject: Re: using the CommonC++ library in WIN32
> 
> 
> As I do not spend any time at present developing on the Win32 platform,
> I do not have any immediate suggestion, however, I assume there are
> others on the list that do and will.  I do have in mind to start an
> interesting project that will include a win32 target, however, so I
> expect I will also spend a lot of time finding these leftover issues
> with the win32 build very soon :).
> 
> Massimo Balestri wrote:
> 
>  > Hi all,
>  > (sorry for any duplicate e-mail, I don't know exactly which reflector
>  > is currently in use);
>  > I am trying to use CommonC++ 1.4.2. on a set of WIN32 machines (98,
>  > NT, 2000).
>  > I use VC++ 6.0 (SP4) to compile the library.
>  > I can compile the library without problems, but when I try to use it,
>  > each time I include
>  > "thread.h" I get the following level-1 warnings:
>  > --------------------------
>  > Compiling...
>  > threadtest.cpp
>  > c:\workspace\ovm_code\common\commoncxx\thread.h(486) : warning C4273:
>  > 'waitThread' : inconsistent dll linkage.  dllexport assumed.
>  > c:\workspace\ovm_code\common\commoncxx\thread.h(487) : warning C4273:
>  > 'delay' : inconsistent dll linkage.  dllexport assumed.
>  > c:\workspace\ovm_code\common\commoncxx\thread.h(488) : warning C4273:
>  > 'yield' : inconsistent dll linkage.  dllexport assumed.
>  > c:\workspace\ovm_code\common\commoncxx\thread.h(490) : warning C4273:
>  > 'getException' : inconsistent dll linkage.  dllexport assumed.
>  > c:\workspace\ovm_code\common\commoncxx\thread.h(491) : warning C4273:
>  > 'setException' : inconsistent dll linkage.  dllexport assumed.
>  > Linking...
>  > -----------------------------------
>  > Then the simple example runs without problems, but I suppose that this
>  > is not a good sign.
>  > My impression is that more complex examples could go into troubles.
>  > Attached is the test code (a very simple code...)
>  >
>  > with kind regards,
>  > Massimo.
>  > ------------------------------
>  > #include "config.h"
>  > #include "thread.h"
>  > #include "socket.h"
>  >
>  > class ThreadTest : public Thread
>  > {
>  >   private:
>  >     int  _threadID;                // a simple user-defined thread
>  > identifier
>  >     Mutex * mutex;                // mutex shared between several 
> threads
>  >
>  >     void Run()
>  >     {
>  >         int i = 0 ;
>  >         while (true)
>  >         {
>  >             mutex->EnterMutex();
>  >             cout << "Thread ID="<< _threadID <<", loop
>  > number="<<(i++)<< endl;
>  >             mutex->LeaveMutex();
>  >             Sleep(20);
>  >         }
>  >     };
>  >
>  >     void Final()
>  >     {
>  >         cout << "Thread " << _threadID <<" exiting."<< endl;
>  >     };
>  >
>  >   public:
>  >
>  >     ThreadTest(int threadID, Mutex * mutexPar): _threadID(threadID)
>  >     {
>  >         mutex = mutexPar;    // initialise the mutex
>  >     };
>  >
>  >     ~ThreadTest()
>  >     {
>  >         Terminate();
>  >     };
>  >
>  > };
>  >
>  > int main()
>  > {
>  >     Mutex *m = new Mutex();
>  >     ThreadTest *thread1 = new ThreadTest(1,m);
>  >     ThreadTest *thread2 = new ThreadTest(2,m);
>  >     ThreadTest *thread3 = new ThreadTest(3,m);
>  >     cout << "Starting 3 threads named 1,2,3." << endl;
>  >     thread1->Start();
>  >     thread2->Start();
>  >     thread3->Start();
>  >     sleep(5);                        // wait 5 seconds
>  >     delete thread1;
>  >     delete thread2;
>  >     delete thread3;
>  >     delete m;
>  >     cout << "Main exiting." << endl;
>  >     return 0;
>  > }
>  >
>  > ----------------------------
>  > Massimo Balestri
>  > TELECOM ITALIA LAB
>  > Multimedia Division
>  > Via G. Reiss Romoli, 274
>  > I 10148 TORINO (I)
>  > Tel: + 39 011 228 6176
>  > Fax: + 39 011 228 6299
>  > http://www.telecomitalialab.com
>  >
>  >
>  > _______________________________________________
>  > Bug-commoncpp mailing list
>  > address@hidden
>  > http://mail.gnu.org/mailman/listinfo/bug-commoncpp
>  >
> 
> 
> 
> _______________________________________________
> Bug-commoncpp mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/bug-commoncpp




reply via email to

[Prev in Thread] Current Thread [Next in Thread]