Lisp HUG Maillist Archive

RE: FLI and delivery

> ...
> I encounter the following error when delivering at level 2
> 
> Error: Failed to find address for external symbol "ServiceMain".
> 
> I guess it is caused by the definition
> 
> (fli:define-foreign-callable ("ServiceMain" :encode :source
> :result-type :void)
>     ((argc dword)
>      (argv (:pointer :pointer)))
> ...
> 
> (deliver 'ntservice::standard-main "mysrv.exe" 2
>          :keep-symbols '(|%FOREIGN-CALLABLE/ServiceMain|
> service-control-handler servicemain |ServiceMain| "ServiceMain")
>          :interface :capi)
> 
> but none of the :keep-symbols helps.
> 
> ...

I'm sorry - the solution is quiet simple:

(deliver 'ntservice::standard-main "mysrv.exe" 5
         :multiprocessing t
         :keep-symbols '(ntservice::|%FOREIGN-CALLABLE/ServiceMain|))

makes the app working and utterly small (3MB) (I just forgot to mention the package).

Rem: This is the most compact working delivery command for my version of ntservice.lisp


Andreas


Re: FLI and delivery

Unable to parse email body. Email id is 6887

AW: FLI and delivery

> > > ...
> > > I encounter the following error when delivering at level 2
> > > 
> > > Error: Failed to find address for external symbol "ServiceMain".
> > > 
> > > I guess it is caused by the definition
> > > 
> > > (fli:define-foreign-callable ("ServiceMain" :encode :source 
> > > :result-type :void)
> > >     ((argc dword)
> > >      (argv (:pointer :pointer)))
> > > ...
> > > 
> > > (deliver 'ntservice::standard-main "mysrv.exe" 2
> > >          :keep-symbols '(|%FOREIGN-CALLABLE/ServiceMain| 
> > > service-control-handler servicemain |ServiceMain| "ServiceMain")
> > >          :interface :capi)
> > > 
> > > but none of the :keep-symbols helps.
> > > 
> > > ...
> > 
> > I'm sorry - the solution is quiet simple:
> > 
> > (deliver 'ntservice::standard-main "mysrv.exe" 5
> >          :multiprocessing t
> >          :keep-symbols 
> '(ntservice::|%FOREIGN-CALLABLE/ServiceMain|))
> > 
> > makes the app working and utterly small (3MB) (I just forgot to 
> > mention the package).
> 
> I suggest using a symbol for the name in cases where the 
> foreign callable is not passed in the :dll-exports option to deliver:
> 
> (fli:define-foreign-callable (service-main :result-type :void)
>     ((argc dword)
>      (argv (:pointer :pointer)))
> ...
> 
> The call to make-pointer will keep the symbol automatically:
> 
> (fli:make-pointer :symbol-name 'service-main :functionp t)
> 
> -- 
> Martin Simmons
> LispWorks Ltd
> http://www.lispworks.com/
> 

Thanks for the hint.

I have to use the symbol |ServiceMain|. I guess because the foreign name accessed by the Service Control Manager is case sensitive.
However |ServiceMain| works w/o any :keep-symbols during delivery.

Andreas


Re: AW: FLI and delivery

Unable to parse email body. Email id is 6889

AW: AW: FLI and delivery

> > > > > ...
> > > > > I encounter the following error when delivering at level 2
> > > > > 
> > > > > Error: Failed to find address for external symbol 
> "ServiceMain".
> > > > > 
> > > > > I guess it is caused by the definition
> > > > > 
> > > > > (fli:define-foreign-callable ("ServiceMain" :encode :source
> > > > > :result-type :void)
> > > > >     ((argc dword)
> > > > >      (argv (:pointer :pointer)))
> > > > > ...
> > > > > 
> > > > > (deliver 'ntservice::standard-main "mysrv.exe" 2
> > > > >          :keep-symbols '(|%FOREIGN-CALLABLE/ServiceMain|
> > > > > service-control-handler servicemain |ServiceMain| 
> "ServiceMain")
> > > > >          :interface :capi)
> > > > > 
> > > > > but none of the :keep-symbols helps.
> > > > > 
> > > > > ...
> > > > 
> > > > I'm sorry - the solution is quiet simple:
> > > > 
> > > > (deliver 'ntservice::standard-main "mysrv.exe" 5
> > > >          :multiprocessing t
> > > >          :keep-symbols
> > > '(ntservice::|%FOREIGN-CALLABLE/ServiceMain|))
> > > > 
> > > > makes the app working and utterly small (3MB) (I just forgot to
> > > > mention the package).
> > > 
> > > I suggest using a symbol for the name in cases where the
> > > foreign callable is not passed in the :dll-exports option 
> to deliver:
> > > 
> > > (fli:define-foreign-callable (service-main :result-type :void)
> > >     ((argc dword)
> > >      (argv (:pointer :pointer)))
> > > ...
> > > 
> > > The call to make-pointer will keep the symbol automatically:
> > > 
> > > (fli:make-pointer :symbol-name 'service-main :functionp t)
> > > 
> > > --
> > > Martin Simmons
> > > LispWorks Ltd
> > > http://www.lispworks.com/
> > > 
> > 
> > Thanks for the hint.
> > 
> > I have to use the symbol |ServiceMain|. I guess because the foreign 
> > name accessed by the Service Control Manager is case sensitive. 
> > However |ServiceMain| works w/o any :keep-symbols during delivery.
> 
> That is odd, because the Windows SCM doesn't know about the 
> name of the ServiceMain function AFAIK.  For example, in 
> http://msdn2.microsoft.com/en-us/library/ms687414.aspx it is 
> called SvcMain. The only requirement is to call 
> StartServiceCtrlDispatcher with the correct function pointer 
> in the table.
> 
> Did you change all of the calls to fli:make-pointer to use 
> 'service-main and also remove the :encode :source from 
> fli:define-foreign-callable?
> 
> ...

Sorry, my fault, of course,
I didn't understand the meaning of :encode :source and was mislead by the existing source code.
Now after removal of :encode :source, service-main is just fine.

Thanks.

Andreas


Updated at: 2020-12-10 08:45 UTC