Subject: Re: Cygwin ports as services under NT?
From: [email-masked]

2 Dec 1996 05:39:44 -0800
Sender: [email-masked]
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
References: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 2.02 (X11; I; AIX 1)
Original-To: [email-masked]
Original-CC: "Dm. Makarov" <[email-masked]>
Original-Sender: [email-masked]

> >> Anyone explored the possibilities of running cygwin programs as services
> >> under NT?
> >
> >I can't think of any reason why you wouldn't be able to do that. As long
> >as you can create structs with longs in them and callback functions, and
> >as long as you can call DLL functions, you should be fine.
> >-
> 
> Services must be multithreaded, so you need to be able to handle that.

I don't think it's really the point. There actually has to be only one thread
besides the process' main thread, the one that is produced by the call to
StartServiceCtrlDispatcher (Service_Table);
It's true that it's convenient to make a service multithreaded, at least to be
able easily pause and resume it, but there's no such a requirement at all.

I just don't see how one using cygwin32 gcc can build an application that uses
Win32 SDK API. Say you need to use winsvc.h #include file for the data structures
like SERVICE_TABLE_ENTRY to be defined and there it starts -- gcc gives a lot
of stuff like "in the file included from service.c: winsvc.h: ..."

The solution is maybe to compile separately the code for the service itself by gcc
and all the stuff you need to `decorate' the application as an NT service by MS VC++
and then link it together (I don't know whether it's possible or not)

Regards,
Dmitri Makarov.
[email-masked]
-
For help on using this list, send a message to
"[email-masked]" with one line of text: "help".