GIDForums  

Go Back   GIDForums > Computer Programming Forums > C Programming Language
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 08-Sep-2005, 16:21
stormlab stormlab is offline
New Member
 
Join Date: Sep 2005
Posts: 20
stormlab is on a distinguished road
Exclamation

Porting of Linux code to windows.


Hello,

I want to port FORTRAN code for linux/unix to windows. I did it at all but I can't compile one small C file because it is linux/unix specific:

http://cyclone.atmos.uiuc.edu/rt/Backup/Gridder3/pregrid/util/cio.c

The FORTRAN codes call the C functions in cio.c which write bytes to UNIX files. As I understand the FORTRAN codes open files, write data inside, and close them using this cio.c functions.

Question: how to modify the cio.c code to compile it under windows? cio.c include <sys/ioctl.h> and <sys/uio.h> which are unix/linux specific. As I know there is no analogue of this include files under windows.

Thank you very much for your ideas!

Sincerely,

Angel Dimitrov
  #2  
Old 09-Sep-2005, 14:08
Dr. Evil Dr. Evil is offline
Member
 
Join Date: Oct 2004
Location: Netherlands
Posts: 120
Dr. Evil will become famous soon enough
It compiled fine for me (with the exception that there was no main(), but I'm sure you've figured that out) on Borland after removing the includes
#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/uio.h>

Although it did give a few warnings about some functions not being prototyped.
  #3  
Old 09-Sep-2005, 15:31
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 4,793
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold
Quote:
Originally Posted by Dr. Evil
It compiled fine for me (with the exception that there was no main(), but I'm sure you've figured that out) on Borland after removing the includes
#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/uio.h>

Although it did give a few warnings about some functions not being prototyped.

The original poster didn't tell us what compiler he is using. I have had great (but not completely 100%) success compiling and executing Linux/Unix programs using Cygwin gcc. (In particular, this program compiles with no errors or warnings with Cygwin gcc on my Windows XP box, so I'm guessing that he is using something else.)

For Borland bcc32 and Microsoft Visual C++ 6.0 the functions open(), creat(), lseek(), read(), write(), and close() are prototyped in <io.h>

By removing the header files that you mention, and by including <io.h>, I get clean compiles with both of these. Whether everything works the same --- I couldn't say, but at least you may get something to test.

Regards,

Dave
  #4  
Old 10-Sep-2005, 02:41
stormlab stormlab is offline
New Member
 
Join Date: Sep 2005
Posts: 20
stormlab is on a distinguished road

open, close, write, read, lseek


Dear programmers,

Thank you very much for your help!

I try to compile the code with Portland Group Workstation Fortran Compiler for Windows which use cygwin/mingw.

Now I will try to compile the codes.

Angel Dimitrov
stormlab.net
 
 

Recent GIDBlogStupid Management Policies by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows and Linux, hosting plans from $2.99/year, reseller from $3/month! hoststock Web Hosting Advertisements & Offers 0 26-Jul-2005 15:16
Windows 2000 & NT source code leak Garth Farley Computer Software Forum - Windows 3 26-Feb-2004 16:23
Installing Linux with Windows ME JdS Computer Software Forum - Linux 4 30-Apr-2003 18:47

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 11:34.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.