Sunday, February 26, 2012

How to Port PThread-Win32

Finally got it!
  1. Put your .h files (pthread.h, semaphore.h, sched.h) into $Visual_Studio/VC/include.
  2. pthreadVC1.dll goes to C:/Windows. Not the best idea but I am out of time and this works.
  3. pthreadVC1.lib goes to $Visual_Studio/VC/lib. Also, include it in the Linker. Project Properties -> Configuration Properties -> Linker -> Input -> Additional Dependencies. Add there pthreadVC1.lib.
These actions should eliminate all external linking errors. Although, you may still have problems when you run the application. I got the error: pthreadVC1.dll missing. In this case, put pthreadVC1.dll into C:/Windows/SysWOW64 where all other dlls are (like kernel32.dll). Probably it is a better solution to start with.

Also, use Sleep() for Windows (add #include <Windows.h>) and sleep() (add #include <unistd.h>) for UNIX-based systems.

No comments:

Post a Comment