Hi,
I translated the CPP example of a windows service to D.
https://docs.microsoft.com/en-us/windows/desktop/Services/svc-cpp
I wonder how can I integrate a vibe.d http server here:
__gshared HANDLE ghSvcStopEvent = NULL;
VOID SvcInit(DWORD dwArgc, LPTSTR* lpszArgv)
{
ghSvcStopEvent = CreateEvent(NULL, // default security
attributes
TRUE, // manual reset event
FALSE, // not signaled
NULL); // no name
if (ghSvcStopEvent == NULL)
{
ReportSvcStatus(SERVICE_STOPPED, NO_ERROR, 0);
return;
}
ReportSvcStatus(SERVICE_RUNNING, NO_ERROR, 0);
// TO_DO: Perform work until service stops.
while (1)
{
WaitForSingleObject(ghSvcStopEvent, INFINITE);
ReportSvcStatus(SERVICE_STOPPED, NO_ERROR, 0);
return;
}
}
WaitForSingleObject will wait forever until ghSvcStopEvent will
be filled
(by extern (Windows) VOID SvcCtrlHandler(DWORD dwCtrl) nothrow).
Do you have any proposal how to integrate vibe.d here?
Kind regards
André