I wanted to create a DLL in delphi that will be called by a C# web service.
This DLL has some database routines like getting info, saving info etc.
I know that DLL has problems if we use global variables. So my plan is to create uniConnection component within a procedure in DLL and then pass along to other procedures as required or is there better way to handle uniConnection in this scenario.
Thank You.
TUniConnection in DLL when called from web service
Re: TUniConnection in DLL when called from web service
Hi,
It is clear you will need a login() and logout() functions.
The login() can create the uniConnection and return a pointer that you can use in all functions including logout() for freeing.
But a better way is login() to return a handle. This handle will be into a list of sessions with thread-safe accesses.
Best Regards,
Cristian Peţa
It is clear you will need a login() and logout() functions.
The login() can create the uniConnection and return a pointer that you can use in all functions including logout() for freeing.
But a better way is login() to return a handle. This handle will be into a list of sessions with thread-safe accesses.
Best Regards,
Cristian Peţa
Re: TUniConnection in DLL when called from web service
Thanks for reply. Can you show an example please?
Thanks.
Thanks.
Re: TUniConnection in DLL when called from web service
Hi,
You can just use the simple way
Best Regards,
Cristian Peţa
You can just use the simple way
Code: Select all
interface
function Connect(out DataModule: Pointer): Boolean; stdcall;
procedure DoSomething(DataModule: Pointer); stdcall;
procedure Disconnect(DataModule: Pointer); stdcall;
implementation
function Connect(out DataModule: Pointer): Boolean; stdcall;
begin
DataModule := TDataModule1.Create(nil);
Result := TDataModule1(DataModule).MyConnect;
end;
procedure DoSomething(DataModule: Pointer); stdcall;
begin
TDataModule1(DataModule).UniQuery1.Open;
end;
procedure Disconnect(DataModule: Pointer); stdcall;
begin
TDataModule1(DataModule).Free;
end;
Cristian Peţa
-
DemetrionQ
- Devart Team
- Posts: 271
- Joined: Wed 23 Jan 2013 11:21
Re: TUniConnection in DLL when called from web service
Hello.
Please specify whether you have already got a C# library with web service and you want to use DLL from it for work with UniDAC, or you want to create a new DLL web service.
Also note that there is a product for C# similar to UniDAC. You can find more information at http://www.devart.com/dotconnect/universal .
Please specify whether you have already got a C# library with web service and you want to use DLL from it for work with UniDAC, or you want to create a new DLL web service.
Also note that there is a product for C# similar to UniDAC. You can find more information at http://www.devart.com/dotconnect/universal .