Free Downloads, Community Forum,
FAQs and Developer Resources


Make /Tools Your Home | Link to us

Today's posts | Posts since last visit | Most Active Topics

All Forums Register Login Search Subscriptions My Profile Inbox
Tool Warehouse FAQs Resources Help Member List Address Book Logout

compile pthreads with Visual Studio

 
Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [SFU / Interix / SUA Technology] >> Interix Advanced Forum >> compile pthreads with Visual Studio Page: [1]
Login
Message << Older Topic   Newer Topic >>
compile pthreads with Visual Studio - Jun. 15, '06, 2:51:36 PM   
wgrigg

 

Posts: 2
Joined: Jun. 15, '06,
Status: offline
All,

Pardon if there is a better forum for this question, but I am somewhat new to the Windows/UNIX world. Here goes ... we have a project that requires rehosting a bunch of C code to Linux on an embedded platform. We are starting out with coLinux on Windows as the development environment. We would like to be able to create a Visual Studio project and at least compile (and even execute) C modules that are pretty much vanilla C except for their interface to the Linux OS. This interface is pretty much calls using pthreads, semaphores and probably messaging.

When I first ran into Windows Services for UNIX 3.5 (today) I mistakenly thought that it supplied that capability. In short I thought that there were some header files (pthread.h, ...) and perhaps a DLL or two that enabled me to just execute as myProg.exe under Windows. Apparently I was wrong... Anyway here are some questions:

1. Any opinions out there about using SFU versus coLinux?
2. Is there a way to build the same set of .c and .h files under coLinux, Interix and Visual Studio?

Any other advice would be greatly appreciated.

TIA,

Bill
Post #: 1
RE: compile pthreads with Visual Studio - Jun. 16, '06, 3:45:14 AM   
Rodney

 

Posts: 3714
Joined: Jul. 9, '02,
From: /Tools lab
Status: offline
A soon as you make a API call outside of the C standard you can't call it vanilla.
Pthreads and semaphores show that the code has complexity wayyy beyond vanilla.
These are all Unix standards (Linux being a variant) for Unix, not Win32.
Win32 does threading and other IPC stuff with a distinctly paradigm than Unix.

Visual Studio (VS) has it's own way of arranging "projects" that are not like
the way you normally do it with Unix systems. Interix and coLinux should be
happy enough using the same *.c and *.h files along with makefiles that are near
if not exactly identical. It's usually very straightforward to move projects from
one unix to another unix. VS will take a large effort that won't reverse easily.

Interix is a Unix system.
The binaries generated are marked as "for Interix", not as "for Win32" (and
no, Win32 is technically not "native" binaries). If you are familiar with the
MACH architecture, it helps in understanding how things are arranged and work.
Interix and Win32 are peer subsystems running over the NT kernel.

coLinux is still a work in progress by what they say in their FAQ. Not everything
may be going that you need on your embedded system. coLinux is a different approach
to running two systems on the same hardware via a device driver instead of VMware.

I think we need to know more about "why" you are wanting to use VS. Particularly
when your end target is going to be embedded Linux.

(in reply to wgrigg)
Post #: 2
RE: compile pthreads with Visual Studio - Jun. 16, '06, 10:31:19 AM   
wgrigg

 

Posts: 2
Joined: Jun. 15, '06,
Status: offline
Rodney,

Thanks for the quick reply. Here are some more facts:

1. The code that we are rehosting is from a "Rabbit" processor using a language called Dynamic C that is 'nearly' C.
2. Several of us like Visual Studio as an IDE.
3. I recently finished a project where I could build a DLL with VS that used exactly the same set of .c and .h files that were used to create a Unix type build with the usual makefile.
4. Granted we need a few #ifdef's to accomplish it, but it was no big deal.
5. Granted also there were no POSIX type interfaces needed in that project
6. Our thinking, currently, goes something like this - we would like to have a 'common' starting point for the stuff that we are rehosting (it is a GNC application with the associated scheduling and serial IO that is needed)
7. If we need to retarget for another platform in the future (UNIX, Linux, VxWorks, QNX, Windows CE, ...) then we would like to just map the OS calls (threads, semaphores, signals, ...) to whatever is needed on the other platform.
8. The GNC code has no direct interface to the OS so it should recompile and execute with no (or very little) change on any number of platforms.
9. The stuff that supports the GNC code is the issue.
10. We thought that there was perhaps an easy one-to-one mapping between POSIX threads and Windows threads so long as we didn't do anything too esoteric.


All that being said, I do not think that we are wedded to coLinux at this point. In fact, at a glance, Interix may be a better choice. We had some difficulty getting coLinux up and running. I would hope that Interix/(Windows Services for UNIX 3.5) is somewhat easier.

We are thinking that maybe some #define's can simply change POSIX thread calls into Windows thread calls. Any thoughts on that?

Or, any additional thoughts whatsoever?

TIA,

Bill

(in reply to Rodney)
Post #: 3
RE: compile pthreads with Visual Studio - Jun. 16, '06, 1:01:52 PM   
Rodney

 

Posts: 3714
Joined: Jul. 9, '02,
From: /Tools lab
Status: offline
> 10. We thought that there was perhaps an easy one-to-one mapping between POSIX threads and Windows threads so long as we didn't do anything too esoteric.

uh, no. The two models are different.
There is somewhere a Win32 version of Pthreads, but I haven't looked at it in a long time.
That may meet more of what you're looking for. Not trying to discourge you from trying to
use Interix (the setup is easy enough, though please refer to the FAQ's to save some time).
ANyway, the reason I mention this Win32 Pthread library is that Interix doesn't run on CE.

There was another Forum member who posted with the past couple of months about using VS to
build Interix binaries. He had a couple of good responses. The posting thread is:
http://www.interopsystems.com/tools/tm.aspx?m=8575&mpage=1&key=Visual%2cStudio⊲

(in reply to wgrigg)
Post #: 4
Page:   [1]
All Forums >> [SFU / Interix / SUA Technology] >> Interix Advanced Forum >> compile pthreads with Visual Studio Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Search All Forums -

Advanced search


SPONSORS



Forum Software © ASPPlayground.NET Advanced Edition 2.5 ANSI

0.031