Converting Linux source code to Windows containing signal()

Discussion in 'C Programming' started by responsible, Apr 16, 2007.

  1. responsible

    responsible Guest

    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
    responsible, Apr 16, 2007
    #1
    1. Advertising

  2. 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>
    Clever Monkey, Apr 16, 2007
    #2
    1. Advertising

  3. responsible

    llothar Guest

    On 16 Apr., 07:17, "responsible" <> wrote:

    > 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
    llothar, Apr 17, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Michael Pronath
    Replies:
    1
    Views:
    1,166
    Diez B. Roggisch
    Jan 3, 2005
  2. newdaddy
    Replies:
    5
    Views:
    773
  3. Ken Cecka
    Replies:
    4
    Views:
    687
    Mike Treseler
    Sep 29, 2008
  4. Replies:
    6
    Views:
    1,313
  5. Replies:
    1
    Views:
    398
Loading...

Share This Page