#1 2021-06-08 10:08:24

Bsaidus
Member
From: Algeria
Registered: 2018-12-16
Posts: 50

Mormot functions in a DLL

Hello,
I have posted a question in lazarus forum
Issue With DLL, exposing some problems related to some made functions incapsulating mORMot functions and classes instances.
So.
Can we instantiate a Connection to remote server with global variable located in a DLL.
if no Can I initialise a global variable in Program, and give it as parameter to functions located in DLL.

Thank you.

Last edited by Bsaidus (2021-06-08 10:08:38)

Offline

#2 2021-08-16 07:17:43

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,183
Website

Re: Mormot functions in a DLL

The natural way of communicating with a mORMot DLL is to use its TRestServer.ExportServerGlobalLibraryRequest in mORMOt 2 for instance or TSQLRestServer.ExportServer for mORMot 1.

Offline

#3 2021-08-24 10:49:31

squirrel
Member
Registered: 2015-08-13
Posts: 146

Re: Mormot functions in a DLL

Would the opposite of this be possible?

I have a generic mormot server that is used for authentication and to perform some calculations and database actions.  This runs offline directy at customers' sites.  For some customers, some of the interface functions must be replaced to do calculations differently.

Since I do not want to recompile the exe for every customer request, I'm hoping to move only those functions to a dll and have the mormot server use the custom versions of the functions in the dll if they are present.

From my understanding of TSQLRestServer.ExportServer, the expectation is that the entire mormot server will live inside the dll.  Is that correct?  I hope to keep the rest server inside my main exe (since that is its only reason to exist) and just extend it with additional or replacement interface functions from the dll.  Would that be possible?

Offline

#4 2021-08-24 11:32:44

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,183
Website

Re: Mormot functions in a DLL

What you expect is perhaps to have two servers.
The DLL is not a "server" in terms of HTTP, but more like a processing unit.
Then you publish the calculations of this DLL to the real main "server".

Offline

#5 2021-08-25 06:36:52

squirrel
Member
Registered: 2015-08-13
Posts: 146

Re: Mormot functions in a DLL

That would work, I'll just have to consider that the functions in the dll will need db access and should not be able to be used by other unauthenticated programs/users

Offline

#6 2021-08-25 10:19:03

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,183
Website

Re: Mormot functions in a DLL

You can still use the whole authentication mechanism of mORMot in the dll "server".

Offline

Board footer

Powered by FluxBB