Print Thread
passing session to dll variable
#412 04/01/00 12:57 AM
Joined: Mar 2000
Posts: 13
Reisterstown, MD, USA
I
igon Offline OP
Member
OP Offline
Member
I
Joined: Mar 2000
Posts: 13
Reisterstown, MD, USA
What is the update on the fix for the following that was sent to me?

I have continued my investigation, and have found that the following causes
the problem:

1. In the host application a variable is declared.
2. In the DLL this variable is deleted.
3. In the DLL a new variable is declared => EListError.

It turns out that this problem occurs in the TCollection implementation,
inside Classes.pas. Variables are collection items, and you can reproduce
the problem by creating a TCollection instance in the host application,
creating an item on it, freeing the item in the DLL, and adding a new one.
The EListError will occur in this situation as well.

I have no idea what is going on here, and I can't find any reference to it
in any of the Delphi resources.

For the time being you can perhaps use the ExternalLDA property to share
sessions between a host application and DLL's. This should work just fine
(no memory management issues), and has an extra advantages that you don't
need ShareMem / borlndmm.dll, and that the DLL can be compiled with a
different version of Direct Oracle Access than the host application.

The downside of the ExternalLDA property is that you must set
TOracleSession.Preferences.UseOCI7 to True. As a result, you cannot use any
Net8 specific objects (CLOB's, BLOB's, Objects). We hope to address this in
the next patch release.

Greetings,
Marco Kalter (support@allroundautomations.nl)
Allround Automations (http://www.allroundautomations.nl)

Re: passing session to dll variable
#413 04/03/00 08:41 PM
Joined: Aug 1999
Posts: 22,220
Member
Offline
Member
Joined: Aug 1999
Posts: 22,220
Version 3.3.3 fixes this issue. You can now use TOracleSession.Share(ToSession) to share a physical database session between 2 TOracleSession instances. This will work regardless of the OCI version (SQL*Net or Net8), and doesn't require the ShareMem unit if you are sharing a session between a host application and a DLL.


------------------
Marco Kalter
Allround Automations


Marco Kalter
Allround Automations
Re: passing session to dll variable
#414 04/03/00 11:34 PM
Joined: Mar 2000
Posts: 13
Reisterstown, MD, USA
I
igon Offline OP
Member
OP Offline
Member
I
Joined: Mar 2000
Posts: 13
Reisterstown, MD, USA
I tried using the share method on the load of my dll with the following code:

function UT_Load(AppHandle:THandle;ASession:TOracleSession):Boolean;StdCall;
var
Antek_Ini: TIniFile; // INI file handle
begin
Result := TRUE;
try
Application.Handle := AppHandle;
FM_MacroSetup := TFM_MacroSetup.Create
Application);
FM_Notes := TFM_Notes.Create(Application);
FM_ShowMacros := TFM_ShowMacros.Create(Application);
DM_Util := TDM_Util.Create(Application);
DM_Util.SES_Common.Share(ASession);

// read INI file to get workstation number
Antek_Ini := TIniFile.Create('c:\Antek\Antek.ini');
try
{Logon to the database}
if not DM_Util.SES_Common.Connected then
begin
Result := FALSE;
Exit;
end;
finally
Antek_ini.Free;
end;

UT_SetApplicationVersion(ExtractFileName(GetVersionInf(TRUE)),GetVersionInf(FALSE));

except
on E:Exception do
begin
ShowMessage(E.Message);
Result := FALSE;
Exit;
end;
end;
end;

On the share method I get the following error.

ExternalLDA only valid when connected through OCI7 and it will not share the session. Please help. Can you provide me with an example or sample project that does not use OCI7=TRUE?

Thanks.

Re: passing session to dll variable
#415 04/04/00 07:01 PM
Joined: Aug 1999
Posts: 22,220
Member
Offline
Member
Joined: Aug 1999
Posts: 22,220
Are you using version 3.3.3?


------------------
Marco Kalter
Allround Automations


Marco Kalter
Allround Automations
Re: passing session to dll variable
#416 04/04/00 07:28 PM
Joined: Mar 2000
Posts: 13
Reisterstown, MD, USA
I
igon Offline OP
Member
OP Offline
Member
I
Joined: Mar 2000
Posts: 13
Reisterstown, MD, USA
yes -- I downloaded it yesterday

Re: passing session to dll variable
#417 04/06/00 08:33 PM
Joined: Aug 1999
Posts: 22,220
Member
Offline
Member
Joined: Aug 1999
Posts: 22,220
You can download a DLL demo here:

http://www.allroundautomations.nl/download/dlldemo.zip

This is a Delphi project that uses various methods to share a session between the host application and a DLL.


------------------
Marco Kalter
Allround Automations


Marco Kalter
Allround Automations
Re: passing session to dll variable
#418 04/07/00 01:01 AM
Joined: Mar 2000
Posts: 13
Reisterstown, MD, USA
I
igon Offline OP
Member
OP Offline
Member
I
Joined: Mar 2000
Posts: 13
Reisterstown, MD, USA
The problem was that I was calling the share in the dll without first logging in the query in the main application. Could you please clearify the error for others in the future who may do this or put it in the help file. Thanks alot for the demo -- it helped solve the problem.

Re: passing session to dll variable
#419 04/07/00 06:02 PM
Joined: Aug 1999
Posts: 22,220
Member
Offline
Member
Joined: Aug 1999
Posts: 22,220
I would have expected a better error message, so that you immediately know what's wrong. That is how we are going to address this problem of course.

------------------
Marco Kalter
Allround Automations


Marco Kalter
Allround Automations

Moderated by  support 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.1.33 Page Time: 0.040s Queries: 13 (0.004s) Memory: 2.5303 MB (Peak: 3.0430 MB) Data Comp: Off Server Time: 2024-05-20 00:28:22 UTC
Valid HTML 5 and Valid CSS