Windows service/daemon no longer compiles lazarus / 34-Windows ---------------------------------------------------------------------- TyneBridges · 2020-08-10 09:49 I've just uninstalled Lazarus 2.0.8 and installed Lazarus 2.0.10 in an attempt (with the help of PascalDragon) to add detection of user logons to a service which was basically written for me some years ago. I knew that I would have to recreate the service and realised this wouldn't be easy for a programmer with my limited ability. However, I've fallen at the first hurdle. The service (unchanged so far) that compiled and ran fine under the old Lazarus will no longer compile. I've added LazDaemon to the new installation, rebuilt the IDE and attempted to build the service. I immediately see the following error: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Compile Project, Target: bc2.exe: Exit code 1, Errors: 1daemonmapperunit1.pas(15,17) Error: Forward declaration not solved "DaemonMapper1Create(TObject);" I must be missing something obvious but don't understand why this would compile under the old Lazarus but now won't. Obviously there is code missing or not found, but what is that? I've checked the Wiki (https://wiki.freepascal.org/Daemons_and_Services), change logs and the Readme but can't see any mention of changes to how daemons work. I've attached my project. Thanks for any help. ---------------------------------------------------------------------- Thaddy · 2020-08-10 09:52 Rights? ---------------------------------------------------------------------- TyneBridges · 2020-08-10 10:06 Quote from: Thaddy on August 10, 2020, 11:52:31 amRights? Sorry, I don't understand. If it was down to permissions, wouldn't the compiler say something like "File access denied"? I'm logged on as an Administrator and have not had that type of issue in Lazarus before. ---------------------------------------------------------------------- paweld · 2020-08-10 10:42 delete line 15 from DaemonMapperUnit ([procedure DaemonMapper1Create(Sender: TObject); ) or add definition of this procedure ---------------------------------------------------------------------- TyneBridges · 2020-08-10 10:59 Quote from: paweld on August 10, 2020, 12:42:27 pmdelete line 15 from DaemonMapperUnit ([procedure DaemonMapper1Create(Sender: TObject); ) or add definition of this procedure Thanks! That fixed the compilation error. Obviously the way the FreePascal compiler treats undefined procedures has changed. Unfortunately, removing the line allows the service to compile but not to run - it gives "OnCreate: Invalid value for property" on attempting to install it. As no property values were set in the old version, I don't know why this is happening or how to fix it. All this makes me realise how little I understand... ---------------------------------------------------------------------- paweld · 2020-08-10 11:37 this isn't empty procedure - it's not defined. empty procdure is like this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure empty;beginend; ---------------------------------------------------------------------- PascalDragon · 2020-08-10 12:44 Quote from: TyneBridges on August 10, 2020, 12:59:55 pmQuote from: paweld on August 10, 2020, 12:42:27 pmdelete line 15 from DaemonMapperUnit ([procedure DaemonMapper1Create(Sender: TObject); ) or add definition of this procedure Thanks! That fixed the compilation error. Obviously the way the FreePascal compiler treats undefined procedures has changed. Unfortunately, removing the line allows the service to compile but not to run - it gives "OnCreate: Invalid value for property" on attempting to install it. As no property values were set in the old version, I don't know why this is happening or how to fix it. All this makes me realise how little I understand... Check whether the OnCreate event is set in the object inspector when you switch to the form view of DaemonMapper1. If so, clear it. Note: I really doubt that this originally compiled in 3.0.4, because the method definition of the event handler was simply missing. ---------------------------------------------------------------------- TyneBridges · 2020-08-10 12:53 Quote from: PascalDragon on August 10, 2020, 02:44:27 pmQuote from: TyneBridges on August 10, 2020, 12:59:55 pmQuote from: paweld on August 10, 2020, 12:42:27 pmdelete line 15 from DaemonMapperUnit ([procedure DaemonMapper1Create(Sender: TObject); ) or add definition of this procedure Thanks! That fixed the compilation error. Obviously the way the FreePascal compiler treats undefined procedures has changed. Unfortunately, removing the line allows the service to compile but not to run - it gives "OnCreate: Invalid value for property" on attempting to install it. As no property values were set in the old version, I don't know why this is happening or how to fix it. All this makes me realise how little I understand... Check whether the OnCreate event is set in the object inspector when you switch to the form view of DaemonMapper1. If so, clear it. Note: I really doubt that this originally compiled in 3.0.4, because the method definition of the event handler was simply missing. Thank you. There was an event there and clearing it did the trick - the old service will now compile and run. I hadn't realised the form view even existed in Lazarus for non-visual applications. Now for the next stage of creating a similar service including the detection of user logons. ---------------------------------------------------------------------- PascalDragon · 2020-08-11 07:29 Quote from: TyneBridges on August 10, 2020, 02:53:13 pmThank you. There was an event there and clearing it did the trick - the old service will now compile and run. I hadn't realised the form view even existed in Lazarus for non-visual applications. Now for the next stage of creating a similar service including the detection of user logons. A form doesn't always exist for non-visual applications. It's just that daemon applications provide them for both the mapper and the daemon so that you could put direct TComponent descendants on them (e.g. database components). If you'd manually write a daemon application there wouldn't be a form.