DLLs are dynamic link libraries, that is, they are loaded the moment a program or another DLL references it during execution.
As I understand the above problem, you need a program that performs a procedure every 1 second. The best way I know of doing this in Windows is by creating a service and registering it in Service Control Manager.
There is this tutorial link
Services are programs without graphical interface (because they run in the background) and are managed by Windows.
I believe you are using Delphi, in this case it is very simple to create services with Delphi. Go to the wizard menu for a new project and indicate that you want to create a Windows service project.
By the nature of a Windows service, you will need to implement 3 methods in your startup class - Start and Stop - They will be called by Windows to start and stop the service, respectively. It's up to you to implement what your service will do at startup.
As it requires monitoring every 1 second, I would do something like this:
procedure TsrvPrincipal.ServiceExecute(Sender: TService);
begin
while not self.Terminated do begin
Sleep(1000); // Aguarda 1 segundo
executeMonitoring(); // Realiza o monitoramento
end;
end;
When compiling your service, Delphi will create an executable file. To run the service you must first register it in Service Control Manager. To do this, call your program with the / INSTALL parameter.
From there, it will be available in the Service Control Manager, and you can start or stop it through the Control Panel - > Services.
I hope I have helped.