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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
04-29-2004, 04:15 AM
|
#1
|
LQ Newbie
Registered: Apr 2004
Posts: 23
Rep:
|
HANDLE support for Linux
Hi, I am working on a Project which was using the Windows based Platform. I wish to make it work on the Linux Platform.
In a file which is using a term HANDLE (i suppose being defined in Windows.h File), i am facing problem.
Can any one suggest some alternative for this definition ?
thanks
Sheena !

|
|
|
04-29-2004, 08:25 AM
|
#2
|
Member
Registered: Aug 2003
Location: Santa Clara, CA
Distribution: Slackware
Posts: 895
Rep:
|
A HANDLE in Windows, is basically a void* that is used to identify a resource. (fonts, bitmaps, windows, etc.) In WinNT.h, it is defined as:
typedef void *HANDLE;
|
|
|
04-30-2004, 06:33 AM
|
#3
|
Member
Registered: Mar 2004
Posts: 79
Rep:
|
Yes thats fine
But What is the substitue in Linux.
I want to make my source code running!!!!
|
|
|
04-30-2004, 08:30 AM
|
#4
|
Member
Registered: Aug 2003
Location: Santa Clara, CA
Distribution: Slackware
Posts: 895
Rep:
|
As I said already:
typedef void *HANDLE;
If you are trying to convert something that gives you a specific type of HANDLE you are going to have to be a LOT more specific, because for obvious reasons, the Win32 API calls do not work under Linux.
|
|
|
05-01-2004, 02:14 AM
|
#5
|
LQ Newbie
Registered: Apr 2004
Posts: 23
Original Poster
Rep:
|
Can any one let me know :
How to make HANDLE work in Linux....from the source files which were running in Windows system
|
|
|
05-01-2004, 11:25 AM
|
#6
|
Moderator
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,795
|
A void* works equally fine under linux or any other O/S, even when called HANDLE.
The problem is not with this type name, but with the rest of the code you want to port.
Instead of trying that, one way to explore could be using Wine to make your program directly run under linux.
|
|
|
05-01-2004, 11:57 AM
|
#7
|
Member
Registered: Mar 2003
Posts: 804
Rep:
|
iirc, a handle is actually a DWORD, aka u_int; usually just a small unsigned integer identifier.
|
|
|
05-01-2004, 10:10 PM
|
#8
|
Member
Registered: Aug 2003
Location: Santa Clara, CA
Distribution: Slackware
Posts: 895
Rep:
|
Quote:
Originally posted by infamous41md
iirc, a handle is actually a DWORD, aka u_int; usually just a small unsigned integer identifier.
|
The typedef I posted is pulled right out of winnt.h. The way it's used, it isn't conceptually that much different from a DWORD, though.
|
|
|
05-02-2004, 12:53 PM
|
#9
|
Member
Registered: Mar 2003
Posts: 804
Rep:
|
my bad, thanks for clearin up. and yup i guess u can cast it to w/e u want anyhow
|
|
|
05-03-2004, 12:48 AM
|
#10
|
Member
Registered: Oct 2003
Location: Ireland
Distribution: Slackware 9.1, Ubuntu
Posts: 192
Rep:
|
isn`t a file descriptor the Linux equivalent of a handle?
|
|
|
05-03-2004, 05:38 AM
|
#11
|
Moderator
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,795
|
no, a file descriptor directly map to a kernel per process table allowing read an write operations to files and sockets, while a handle is working at libray level to access things like windows, fonts, nothing about kernel nor I/O ...
|
|
|
05-03-2004, 08:18 AM
|
#12
|
Member
Registered: Aug 2003
Location: Santa Clara, CA
Distribution: Slackware
Posts: 895
Rep:
|
Quote:
Originally posted by jlliagre
no, a file descriptor directly map to a kernel per process table allowing read an write operations to files and sockets, while a handle is working at libray level to access things like windows, fonts, nothing about kernel nor I/O ...
|
That's not completely accurate. There is an HANDLE in Win32 that is returned and used by functions like CreateFile, WriteFile, ReadFile, etc.
Anyway, unless the original poster tells us EXACTLY what functions he's trying to get to work in Linux there is no way anyone can tell him what the equivalent would be in Linux. My suggestion to him would be to learn one of the GUI APIs for linux like GDK+, then try to learn at least enough about the Win32 API that he can understand how he needs to port it. (Or whatever his app is currently using, be it MFC, OWL, etc..) It's either that or trying to get it working with wine, as someone else already mentioned.
Just knowing that a HANDLE is really a void* likely isn't going to be enough...
|
|
|
All times are GMT -5. The time now is 05:00 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|