473,796 Members | 2,541 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Converting Linux source code to Windows containing signal()

Hi,
I am trying to convert a small piece of source code that was
initially written for Linux to build under Windows.
My main problem though is in two lines...

1. signal(SIGALRM, timeoutHandler) ; // set alarm signal handler
2. alarm (timeout);

I am not sure what the best method is to handle those? Are there any
constructs in Windows that will make the translation as painless as
possible?

Thanks a lot in advance

Apr 16 '07 #1
2 5482
responsible wrote:
I am trying to convert a small piece of source code that was
initially written for Linux to build under Windows.
My main problem though is in two lines...

1. signal(SIGALRM, timeoutHandler) ; // set alarm signal handler
2. alarm (timeout);

I am not sure what the best method is to handle those? Are there any
constructs in Windows that will make the translation as painless as
possible?
This is pretty much off-topic for comp.lang.c, so I suggest you try
another more appropriate newsgroup.

<div class="offtopic >
You have (at least) two main choices:

1. Rewrite the code so it uses Win32 API equivalents to the Linux/POSIX
calls you are having trouble with.

2. Use a third-party bridge API that allows you to compile Unix/POSIX
code on Win32 with minimal changes.
</div>
Apr 16 '07 #2
On 16 Apr., 07:17, "responsibl e" <msd...@gmail.c omwrote:
1. signal(SIGALRM, timeoutHandler) ; // set alarm signal handler
2. alarm (timeout);

I am not sure what the best method is to handle those? Are there any
constructs in Windows that will make the translation as painless as
possible?
No. It is a huge rewrite unless you use an emulated unix environment
like Cygnus
(which has terrible run time performance overhead on some constructs
like signal handling).

If you are able to find a good newsgroup about win32 programming with
competent persons
on it please tell me the URL via PM. But it is offtopic here

Apr 17 '07 #3

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

Similar topics

3
9910
by: Alex Hunsley | last post by:
I'm running a monitoring script under linux written in python. It's nohup'ed so that I can log out and it will continue running happily and so on, but sometimes I need to kill the script before editing the source and relaunching it. Question is, what's the nicest way to kill the python process under linux? Is a simple 'kill ' the nicest way to do it, or is there a different signal I should send it? ta alex
1
2117
by: Josef Meile | last post by:
Hi, I'm trying to do a simple link checking for python 2.1.3 (compiled from source on linux), but it fails when I use an invalid ssl url. For example: I have zope without ssl running on port 8080, if I do this on the browser's address bar: https://my_ip:8080 --> The https is intentional mozilla on linux and IE on windows, take a long time till a timeout
2
6898
by: shyamal | last post by:
I want to display memory content using C++ on LINUX. For example, the user may ask to display 256 bytes from 0x1000ff00. The problem is , if any location is invalid, the program will coredump because of attempt to access invalid memory.I understand that in Windows OS there is a function that tells if a memory location is valid or invalid. Is there a similar function in Linux? How does gdb display memory content? I will appreciate a...
383
12273
by: John Bailo | last post by:
The war of the OSes was won a long time ago. Unix has always been, and will continue to be, the Server OS in the form of Linux. Microsoft struggled mightily to win that battle -- creating a poor man's DBMS, a broken email server and various other /application/ servers to try and crack the Internet and IS markets. In the case where they didn't spend their own money to get companies to
2
555
by: Shantanu Bhattacharya | last post by:
Hi, I have a 2-tier application that allows the end user to create a form containing controls of the user's choice. The same user can then populate the database by entering data created using the form he created. I have to convert this 2-tier application to a 3-tier application. Since the form is created on the fly, all the information related to the controls is also stored in the database. So, there is a lot of
28
3604
by: Randy Reimers | last post by:
(Hope I'm posting this correctly, otherwise - sorry!, don't know what else to do) I wrote a set of programs "many" years ago, running in a type of basic, called "Thoroughbred Basic", a type of business basic. I need to re-write it, bring it kicking and screaming to run on Windows XP. This is for a video rental place, tracks movie and game rentals, customers, employee transactions, reservations, does reports,..... and on. I know some of...
0
1932
by: clinnebur | last post by:
We have an ASP.NET web application (C#) that copies videos from a CCTV truck to a Linux server. What I am trying to do is convert the .AVI videos(which is how they are created on the truck) to .WMV in my C# code using Windows Media Encoder. I have a virtual directory to the truck location of the videos. I also have a virtual directory created to the Linux box. The application resides on a Windows Server 2003 and I am using VS 2005, .NET...
5
2475
by: John Ladasky | last post by:
Hi folks, Running Python 2.5 on both a Windows XP laptop, and an Ubuntu Linux 7.04 desktop. I've gotten tired of maintaining multiple copies of my personal modules that I use over and over. I have copies of these files in the same directory as the main program I happen to be working on at the time. I've also downloaded FANN, and want to use its Python bindings. FANN does not seem to build automatically, like wxWidgets
11
3911
by: Keith Hughitt | last post by:
Hi, I am having a little trouble figuring out how to convert a python datetime to UTC. I have a UTC date (e.g. 2008-07-11 00:00:00). I would like to create a UTC date so that when I send it to MySQL (which treats all dates at local dates by default), it will already have incorporated the proper UTC offset. I've tried looking through the docs http://python.active-venture.com/lib/datetime-datetime.html), but have not had any luck.
0
9685
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
9531
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10459
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
10237
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...
0
10018
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9055
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...
1
7553
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5446
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2928
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.