You can write a 32-bit service as pure 32-bit code, except for the files containing your main program and your signal handler. For those files, use a compiler that supports mixed-model programming, calling in particular 16-bit OS/2 APIs from 32-bit code.
Because the OS/2 2.x toolkit does not supply a prototype for DosSetSigHandler(), you must supply it yourself. To do this, your main program should include the following:
#define INCL_DOSSIGNALS
#include <os2.h> /* From the TOOLKT21\C\OS2H directory */
#define INCL_32 /* Mixed-model LAN Server programming */
#include <netcons.h> /* From the header files supplied with LAN Server */
#include <service.h> /* From the header files supplied with LAN Server */
/* The typedef and the prototype come from the OS/2 1.3 toolkit */
typedef void (* APIENTRY16 PFNSIGHANDLER) (USHORT, USHORT);
USHORT APIENTRY16 DosSetSigHandler(PFNSIGHANDLER new_sigfunc,
PFNSIGHANDLER * old_sigfunc,
PUSHORT old_signo,
USHORT sig_flag,
USHORT new_signo);
.
.
.
int main (void) /* or include argc, etc., to taste */
{
.
.
.
DosSetSigHandler((PFNSIGHANDLER)&sig_handler, /* Signal handler address */
NULL, /* Ignore previous handler */
0, /* Ignore previous action */
SIGA_ACCEPT, /* Process the signal */
SERVICE_RCV_SIG_FLAG)); /* This constant is the
same as SIG_PFLG_A */
.
.
.
}