LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-14-2004, 11:39 AM   #1
scm86
Member
 
Registered: Feb 2003
Location: Florida
Distribution: Fedora Core 5 2.6.16-1.2133_FC5smp
Posts: 96

Rep: Reputation: 15
Porting programs to Linux


I have the source code for a program for windows, and was wondering if it could be recompiled or ported to Linux ?

Im not exactly a master programmer, i know a little C, but not alot...

Thanx

Scott McNeely

Last edited by scm86; 01-14-2004 at 05:19 PM.
 
Old 01-14-2004, 11:58 AM   #2
a2ps
Member
 
Registered: Oct 2003
Location: Oeiras, Portugal
Distribution: Fedora Core 4
Posts: 30

Rep: Reputation: 15
hi there,

well i suppose you can port it to whatever OS you want, but you may have to change the source ( a lot even! ). is it a console application? does it use only standard C/C++/whatever? or does it use a specific win library. in that case you will have to change it.

it is an application with a Gui? than you will have to change it also, from the win32 api to any other that linux uses (QT, wxwindows, gtk, etc). you may be lucky and it uses a portable api like QT and wxwindows or even gtk but it may also not work, cause again it may use windows specific library.

so here's the case: you'll have to check the code for windows dependencies and change those to linux.

and... knowing only a little C wont do much help.
 
Old 01-14-2004, 03:52 PM   #3
scm86
Member
 
Registered: Feb 2003
Location: Florida
Distribution: Fedora Core 5 2.6.16-1.2133_FC5smp
Posts: 96

Original Poster
Rep: Reputation: 15
Ok, in windows it runs standalone, no console, with a GUI. im pretty sure that I have QT and gtk stuff on here, so what would i do to change the api once i find it?

in the code it calls windows.h and a couple others to be included, im assuming/hoping that deals with program windows and not the OS, but im not sure...

<edit> Right after i posted i found this:

if (LOWORD(Vbwcc) < BWCCVERSION) then {
sprintf(szBuff, "BWCC.DLL is v%d.%02x!\nNeed BWCC.DLL v2.0 or higher\nCheck C:\\WINDOWS directory\nfor older version...",
bwcc1, bwcc2);
which is the error printed by the program if it cant find a specific DLL, how would i change it to look for something that linux has/can have?
</edit>


Thanx

Scott McNeely

Last edited by scm86; 01-14-2004 at 04:14 PM.
 
Old 01-14-2004, 04:19 PM   #4
deiussum
Member
 
Registered: Aug 2003
Location: Santa Clara, CA
Distribution: Slackware
Posts: 895

Rep: Reputation: 32
You'll have to determine what API is used to create the Window. If it's not some portable API, which it doesn't sound like it probably is, then you are going to have to get your hands dirty by learning that API, and learning an equivalent API available for Linux, or a portable API that does the same thing.

(e.g. if it is using the Win32 API, you will probably find a WinMain function that calls CreateWindow (or CreateWindowEx). These APIs are NOT found for Linux, but you can learn the glX functions, or any of the other windowing libraries you can use under Linux.)
 
Old 01-14-2004, 04:23 PM   #5
deiussum
Member
 
Registered: Aug 2003
Location: Santa Clara, CA
Distribution: Slackware
Posts: 895

Rep: Reputation: 32
Re: Porting programs to Linux

Quote:
Originally posted by scm86
I have the source code for a program for windows, and was wondering if it could be recompiled or ported to windows?
Wait a minute... This has got to be a typo... (Note red part of quote.)
 
Old 01-14-2004, 05:17 PM   #6
scm86
Member
 
Registered: Feb 2003
Location: Florida
Distribution: Fedora Core 5 2.6.16-1.2133_FC5smp
Posts: 96

Original Poster
Rep: Reputation: 15
Red face

hehe, oops, i gues exams had me more messed up than i thought... i have windows program source and want to make it work under linux...

Thanx

Scott McNeely
 
Old 01-14-2004, 07:11 PM   #7
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 51
BWCC.dll is the borland custom controls library, borland never released this for linux so there is no equivelent file so at best the gui will need to be re-written, im sorry to say but this is impossible for someone with just a little knowledge of C - you'll need to know both the windows API and the api your porting to qt/gtk/motif/etc pretty well.

assuming it doesnt use MFC(probably wont with BWCC) then you might have a chance of compiling it under winelib but i have no experience of this.

what does the application do because it would be much easier to find a linux equivelent
 
Old 01-15-2004, 04:03 PM   #8
scm86
Member
 
Registered: Feb 2003
Location: Florida
Distribution: Fedora Core 5 2.6.16-1.2133_FC5smp
Posts: 96

Original Poster
Rep: Reputation: 15
It is a Rocket Altitude Simulation Program, so far ive not found anything that does everything for linux as it does in win...

so it looks like im gonna be learning some C and API stuff, anyone reccomend a book or two?

Thanx

Scott McNeely
 
Old 01-15-2004, 04:18 PM   #9
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 51
by scm86
It is a Rocket Altitude Simulation Program

so does it just do some numerical integration and draw graphs/pictures? if its that simple send me the sourcecode(kev82@khn.homelinux.net) and i'll have a look at it. if its quite complicated then as you say you've got a lot to learn.

for a simple intro to C - chapter 22 of this book
for the windows API (you'll need to fully understand what the program does now) - go here
for a reasonably simple gui toolikt - look here

Last edited by kev82; 01-15-2004 at 04:19 PM.
 
Old 01-15-2004, 04:42 PM   #10
scm86
Member
 
Registered: Feb 2003
Location: Florida
Distribution: Fedora Core 5 2.6.16-1.2133_FC5smp
Posts: 96

Original Poster
Rep: Reputation: 15
it takes a file with thrust-time data and uses user inputed weight, diameter, coefficient of drag to plot both time-altitude and time-velocity to one chart, showing where mach is on that chart, as well as plotting the thrust of the individual motor and all the motors combined...

slightly more than just a simple plot... it needs to work on the same input/output files as the win prog, though that shouldnt be too hard should it?

BTW, i have QT installed, came with RH9, would this work well enuff?

Thanx

Scott McNeely
 
Old 01-15-2004, 05:03 PM   #11
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 51
mail it to me and i'll have a look, it doesnt sound too bad
 
Old 01-15-2004, 10:16 PM   #12
misfit-x
Member
 
Registered: Jan 2004
Location: NY
Distribution: RH9
Posts: 38

Rep: Reputation: 15
I think how I'd approach it is first design the GUI in Linux the same as it was layed out in Windows, using QTDesigner or a GTK designer, etc. Then link it to the code and fill it in with the "guts" from the windows program. Then run it and fine-tune it as you need. For example, if you had an "OK" button on a form you would design an OK button on a QTDsigner or GTK designer form, link it into your program project in say, KDevelop, then fill in the code that was for the OK button in the Windows program put it in for the OK button in the Linux program. If it's standard C++ commands and stuff, it should work, but if not, you might want to find equivelent commands, etc.

Unfortunately, it's not as simple as bring in source code into linux and compile with gc++ and it would work. It won't. The Windows API is very different from X, GTK and QT.
 
Old 01-17-2004, 11:16 PM   #13
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Costa Rica
Distribution: Kubuntu, Debian, Knoppix
Posts: 2,092
Blog Entries: 1

Rep: Reputation: 90
Guys... haven't you thought of trying emulation? Maybe it can run under wine. Give it a try..... You're welcome.
 
Old 01-18-2004, 10:03 AM   #14
scm86
Member
 
Registered: Feb 2003
Location: Florida
Distribution: Fedora Core 5 2.6.16-1.2133_FC5smp
Posts: 96

Original Poster
Rep: Reputation: 15
yeah, it probably can work under wine, but that would require users to download or buy another program to use a free program, if it can be ported over and packaged up, then its just a small download and install to use it.

Is there a tutorial somewhere on how to use glade or QT? Ive been able to get a window and the file edit help menus, but thats about it...

Thanx

Scott McNeely
 
  


Reply



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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
HP-UX to linux porting arunprakash Other *NIX 2 03-01-2005 10:53 PM
Porting C++ from HP-UX 11.0 to Linux paul sachs Other *NIX 2 01-10-2005 05:37 PM
Help Porting C Programs, Utilities, etc.. from HP-UX rmhaddad Linux - Software 2 01-19-2004 03:23 PM
porting programs to linux, io.h, window.h StressedLemming Linux - Newbie 1 11-30-2003 08:33 AM
Porting Programs garbo73 Programming 5 10-10-2003 10:26 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:03 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration