www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Windows service in D

reply "Gifford Hesketh" <gifford.hesketh savvis.net> writes:
A few months ago, I asked if anyone had an example of a Windows service
written in D.  Not finding one, I wrote one -- although there was one
outstanding issue I wanted to resolve before making it public.

Looking at this again, D's tools changes seem to have broken the
compilation.  Before I make anyone wade through my code, does an error like
the following look familiar to anyone ?

\dm\samples\d\service>dmd -v service.d advapi32.lib
parse     service
semantic  service
semantic2 service
semantic3 service
code      service
generating code for function 'main'
generating code for function 'ServiceMain'
generating code for function 'ServiceCtrlHandler'
\dm\bin\link service,,,advapi32.lib+user32+kernel32/noi;
OPTLINK (R) for Win32  Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

service.obj(service)
 Error 42: Symbol Undefined __init_6winsvc19SERVICE_TABLE_ENTRY

--- errorlevel 1
May 26 2004
parent reply "Walter" <newshound digitalmars.com> writes:
If probably means you need to link in the .obj for the module where
SERVICE_TABLE_ENTRY is defined.

"Gifford Hesketh" <gifford.hesketh savvis.net> wrote in message
news:c93ciu$lk8$1 digitaldaemon.com...
 A few months ago, I asked if anyone had an example of a Windows service
 written in D.  Not finding one, I wrote one -- although there was one
 outstanding issue I wanted to resolve before making it public.

 Looking at this again, D's tools changes seem to have broken the
 compilation.  Before I make anyone wade through my code, does an error
like
 the following look familiar to anyone ?

 \dm\samples\d\service>dmd -v service.d advapi32.lib
 parse     service
 semantic  service
 semantic2 service
 semantic3 service
 code      service
 generating code for function 'main'
 generating code for function 'ServiceMain'
 generating code for function 'ServiceCtrlHandler'
 \dm\bin\link service,,,advapi32.lib+user32+kernel32/noi;
 OPTLINK (R) for Win32  Release 7.50B1
 Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

 service.obj(service)
  Error 42: Symbol Undefined __init_6winsvc19SERVICE_TABLE_ENTRY

 --- errorlevel 1
Jun 09 2004
parent "Tyler Jensen" <tyler tsjensen.com> writes:
Ten years is a long time but perhaps this can help anyone running 
into this forum thread.

https://github.com/duovia/WindowsServiceInD

I'm using the Windows API library (source actually) on 
dsource.org. See link on the github page. I found it difficult to 
find a complete solution to the problem, so I'm going to cross 
post in a few places to make it easier to find for others seeking 
an answer to the same question.

On Wednesday, 9 June 2004 at 21:18:45 UTC, Walter wrote:
 If probably means you need to link in the .obj for the module 
 where
 SERVICE_TABLE_ENTRY is defined.

 "Gifford Hesketh" <gifford.hesketh savvis.net> wrote in message
 news:c93ciu$lk8$1 digitaldaemon.com...
 A few months ago, I asked if anyone had an example of a 
 Windows service
 written in D.  Not finding one, I wrote one -- although there 
 was one
 outstanding issue I wanted to resolve before making it public.

 Looking at this again, D's tools changes seem to have broken 
 the
 compilation.  Before I make anyone wade through my code, does 
 an error
like
 the following look familiar to anyone ?

 \dm\samples\d\service>dmd -v service.d advapi32.lib
 parse     service
 semantic  service
 semantic2 service
 semantic3 service
 code      service
 generating code for function 'main'
 generating code for function 'ServiceMain'
 generating code for function 'ServiceCtrlHandler'
 \dm\bin\link service,,,advapi32.lib+user32+kernel32/noi;
 OPTLINK (R) for Win32  Release 7.50B1
 Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

 service.obj(service)
  Error 42: Symbol Undefined __init_6winsvc19SERVICE_TABLE_ENTRY

 --- errorlevel 1
Aug 22 2014