473,748 Members | 9,416 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Porting windows C++ code into Linux

Hi,

I have small code, that compiles on Visual C++ into a shared library
(DLL).

I need to compile it under linux, but the code includes some data
types I'm not familiar with, such as DWORD, HANDLE, __int64, ULONG
etc.

What are those words?

The code also includes <windows.hand <winbase.h>. Do they have linux-
alternatives?

Thanks,
--Lior

Jun 17 '07 #1
7 15663
Lior wrote:
Hi,

I have small code, that compiles on Visual C++ into a shared library
(DLL).

I need to compile it under linux, but the code includes some data
types I'm not familiar with, such as DWORD, HANDLE, __int64, ULONG
etc.

What are those words?

The code also includes <windows.hand <winbase.h>. Do they have linux-
alternatives?

Thanks,
--Lior
No, because <windows.his the API of the Windows operating system.

Some of the types you mention have obvious equivalents, DWORD and ULONG
are 32 bit unsigned integers (might not be so on a 64-bit architecture
though). __int64 is a signed 64 bit integer (obviously). But HANDLE does
not have an obvious Linux equivlanent since it represents some operating
system resource.

But since Windows is so prevalent, and since some Windows programmers
seem unaware of the world beyond Windows, you do see a lot of code that
is needlessly Windows specific.

Maybe your code is like this and you'll find it fairly easy to port, but
without seeing the actual code it's impossible to say.

This isn't really on-topic on comp.lang.c++ which doesn't deal with
platform specific topics (even when its porting from one platform to
another). So you should probably ask again in a Windows group or a Linux
group whichever you think is likely to get you the best answer.

john

Jun 17 '07 #2
Lior wrote:
Hi,

I have small code, that compiles on Visual C++ into a shared library
(DLL).

I need to compile it under linux, but the code includes some data
types I'm not familiar with, such as DWORD, HANDLE, __int64, ULONG
etc.

What are those words?
Topicality aside, the first thing you should do to determine whether it
is possible to port from one platform to another is to remove as many of
the the original platform's quirks from the code, while keeping it
building it on the original platform.

So in this case, start by replacing all the windows specific types with
their standard equivalents, then remove the windows headers and see what
breaks.

--
Ian Collins.
Jun 17 '07 #3
On Jun 18, 4:58 am, Lior <lio...@gmail.c omwrote:
Hi,

I have small code, that compiles on Visual C++ into a shared library
(DLL).

I need to compile it under linux, but the code includes some data
types I'm not familiar with, such as DWORD, HANDLE, __int64, ULONG
etc.

What are those words?

The code also includes <windows.hand <winbase.h>. Do they have linux-
alternatives?

Thanks,
--Lior
If you are using some windows API or something, it will be difficult
to port as they're not available in Linux environment as they're
different. If your code is pure C++, yes you can port it with minimal
change else it would be difficult if you are calling platform
dependent calls.

So first decide whether it is portable or not. If you are doing some
stuffs like Windows Programming, Qt is an alternative. I'm not saying
that your code is portable to Linux using Qt. But you can use Qt in
Windows and Linux as it provides Cross Platform libraries.

Jun 18 '07 #4
saf
Lior wrote:
Hi,

I have small code, that compiles on Visual C++ into a shared library
(DLL).

I need to compile it under linux, but the code includes some data
types I'm not familiar with, such as DWORD, HANDLE, __int64, ULONG
etc.

What are those words?

The code also includes <windows.hand <winbase.h>. Do they have linux-
alternatives?
This data types and header files are not POSIX platform compatible. You
need to convert the data types and to remove the windows and winbase
header and to replace it with a Linux alternative. I guess this header
files are only used for Windows system calls which must be replaced by
POSIX system calls (in your case Linux).

--
saf
E-Mail protected against spam: ih******@smtp2. trashmail.net
Jun 18 '07 #5
On Jun 18, 12:58 am, Lior <lio...@gmail.c omwrote:
Hi,

I have small code, that compiles on Visual C++ into a shared library
(DLL).

I need to compile it under linux, but the code includes some data
types I'm not familiar with, such as DWORD, HANDLE, __int64, ULONG
etc.

What are those words?

The code also includes <windows.hand <winbase.h>. Do they have linux-
alternatives?

Thanks,
--Lior
While there are no direct equivalents on Linux for these windows
header files (and thus their corresponding DLL's), tools like WinDU
(http://www.bristol.com/windu/ http://www.s7solutions.com/wind.asp)
and MainWin (http://www.mainsoft.com/solutions/prof_svcs_ul.aspx)
exist, which provide a Windows library layer on top of Unix/Linux
OSes. You can compile your windows application by linking with these
libraries and get them to work natively on Unix/Linux boxes.

:-)

S7 Software Solutions
"Where Migration meets Innovation"

Jun 19 '07 #6
ku************* *@gmail.com wrote:
On Jun 18, 12:58 am, Lior <lio...@gmail.c omwrote:
>[.. need to port Windows app to Linux ..]

[.. WindU, MainWin recommendation ..]
Those are prohibitively expensive.

Consider trying to just run your app under WINE. No need
to even rebuild it, in many cases. The best solution of
course, is to use portable (cross-platform) libraries for
the "other" stuff (not business logic), like Qt, MySQL,
OpenGL, etc. You basically offload the porting onto their
shoulders.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jun 19 '07 #7
On Tue, 19 Jun 2007 08:39:44 -0400, Victor Bazarov wrote:
ku************* *@gmail.com wrote:
>On Jun 18, 12:58 am, Lior <lio...@gmail.c omwrote:
>>[.. need to port Windows app to Linux ..]

[.. WindU, MainWin recommendation ..]

Those are prohibitively expensive.

Consider trying to just run your app under WINE. No need to even
rebuild it, in many cases. The best solution of course, is to use
portable (cross-platform) libraries for the "other" stuff (not business
logic), like Qt, MySQL, OpenGL, etc. You basically offload the porting
onto their shoulders.

V
Part of the WINE project is libwine which is meant to provide the Windows
API as a library on other platforms. A package called libwine-dev or
similar (depends on the distribution) probably needs to be installed in
order for the header files to be available.

--
Markus Schoder
Jun 20 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
2149
by: Sonny | last post by:
I need to port a library that is written entirely in C to C++. The library is supported on quite a few platforms (windows, Solaris, Linux, AIX, HP-UX, OSX, etc...) and there's quite an existing customer base that uses it. I need to maintain backwards compatibility such that existing users won't have to do anything to their existing applications other than a re-compile when they upgrade to this new version of the library. I figure that I...
2
2386
by: Michael Sgier | last post by:
Hello i'm trying to port a windows program to linux with Kdevelop 1.question: unsigned char *LoadBitmapFile(char *filename, BITMAPINFOHEADER *bitmapInfoHeader); /home/michael/Desktop/div.OpenGL/linshootme/src/texture.h:51: error: type specifier omitted for parameter `BITMAPINFOHEADER' /home/michael/Desktop/div.OpenGL/linshootme/src/texture.h:51: error: syntax error before `*' token
6
1529
by: Raghavendra | last post by:
Hi All, I have one big system application, which is developed for HPUX and Windows in C-language. I need to port it to Linux. What all things do I need to consider to do this. Can you please provide any information or any links to websites? I have searched google, I couldn't find much information on this. Thanks for the help,
1
1613
by: Sunanda | last post by:
Hi, I am a newbie to .Net. I have an application in running in linux, a set of .c and .h files. I also have a makefile in linux to create the executable. I want to port this to windows (.Net environment).
4
3694
by: Chuck Chopp | last post by:
I have an application that I originally built using Visual Studio .NET 2003 as native C++ . This application includes a template class that was derived from the string class that's part of the C++ STL. Specifically, it extends the class with some additional methods to support changes in encoding as well as sprintf-style in-place formatting. Now, I've been asked to provide a version of the application running on Linux. I'm using GCC as...
13
4381
by: jc | last post by:
I have written a parser using bison and flex to read ASAP2 file for CAN communications. entire development was done in an unix environment and now the code is ready to be integrated to an existing CAN communication software that i wrote earlier in windows environment(as we get drivers for these CAN cards only for the windows). my problem started when i started to move the code from linux to the visual studio. after many compilation and...
0
1784
by: Michael Palmer | last post by:
On Sep 16, 12:30 pm, binaryjesus <coolman.gu...@gmail.comwrote: I haven't tried it myself, but I came across a blog post the other day that describes a way of building windows installers for pyGTK applications at http://unpythonic.blogspot.com/2007/07/pygtk-py2exe-and-inno-setup-for-single.html
47
2364
by: =?Utf-8?B?ZW1hdmlzdQ==?= | last post by:
Dear guys, I'm in trouble having to port my project from C++Builder6 to VisualC++. Has anyone of you idea if there are any tools to help my doing this job? My current project is widely using VCL and these 2 IDE (C++Builder and VisualC++) seems to be so far each other that I can hardly think to find out a tool to "automatically" perform something for me. Thank you.
0
1033
by: Ed Leafe | last post by:
On Oct 18, 2008, at 8:12 AM, Dotan Cohen wrote: Sorry for the delay in responding, but someone just pointed out this post to me. You might want to take a look at Dabo, which is an integrated desktop application framework for Python (disclosure: I'm one of the authors). It allows you to visually create UIs that run unmodified on Windows, Linux and OS X.
0
8984
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9530
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9363
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9312
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8237
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6073
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4864
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2775
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2206
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.