Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Pass transactions to DLL



Permlink Replies: 3 - Last Post: Apr 7, 2018 3:32 AM Last Post By: Francisco Arman...
Dawid Najgiebauer

Posts: 4
Registered: 11/24/11
Pass transactions to DLL
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 8, 2018 3:36 AM
Hi,

How can I create in DLL my own TFDTransaction objects attached to passed transactions (not default for connection)?
Jeff Overcash (...

Posts: 1,529
Registered: 9/23/99
Re: Pass transactions to DLL
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 8, 2018 12:03 PM   in response to: Dawid Najgiebauer in response to: Dawid Najgiebauer
On 3/8/2018 6:36 AM, Dawid Najgiebauer wrote:
Hi,

How can I create in DLL my own TFDTransaction objects attached to passed transactions (not default for connection)?

Best if you you use a package instead of a DLL. Both the EXE and package should
be built with run time packages turned on. If you don't do that the RTTI for
that class will be different in your DLL and EXE and anything within the DLL
that requires RTTI will fail (because from the eyes of the DLL it has a
different TFDTransaction class than the EXE passed)

--
Jeff Overcash (TeamB)
(Please do not email me directly unless asked. Thank You)
Learning is finding out what you already know. Doing is demonstrating that you
know it. Teaching is reminding others that they know it as well as you. We are
all leaners, doers, teachers. (R Bach)
Dawid Najgiebauer

Posts: 4
Registered: 11/24/11
Re: Pass transactions to DLL
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 8, 2018 11:21 PM   in response to: Jeff Overcash (... in response to: Jeff Overcash (...
Best if you you use a package instead of a DLL. Both the EXE and package should
be built with run time packages turned on. If you don't do that the RTTI for
that class will be different in your DLL and EXE and anything within the DLL
that requires RTTI will fail (because from the eyes of the DLL it has a
different TFDTransaction class than the EXE passed)

--
Jeff Overcash (TeamB)
(Please do not email me directly unless asked. Thank You)
Learning is finding out what you already know. Doing is demonstrating that you
know it. Teaching is reminding others that they know it as well as you. We are
all leaners, doers, teachers. (R Bach)

I know all about different versions of classes/components, but developing process don't allow use that. So, this is not answer, why with FireDac can share connection (via CliHandle) with default transaction, but can't share other transaction using TFDTransaction object (or I don't know how to do this).

Edited by: Dawid Najgiebauer on Mar 8, 2018 11:24 PM
Francisco Arman...

Posts: 11
Registered: 3/3/01
Re: Pass transactions to DLL
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 7, 2018 3:32 AM   in response to: Dawid Najgiebauer in response to: Dawid Najgiebauer
Dawid Najgiebauer wrote:
Best if you you use a package instead of a DLL. Both the EXE and package should
be built with run time packages turned on. If you don't do that the RTTI for
that class will be different in your DLL and EXE and anything within the DLL
that requires RTTI will fail (because from the eyes of the DLL it has a
different TFDTransaction class than the EXE passed)

--
Jeff Overcash (TeamB)
(Please do not email me directly unless asked. Thank You)
Learning is finding out what you already know. Doing is demonstrating that you
know it. Teaching is reminding others that they know it as well as you. We are
all leaners, doers, teachers. (R Bach)

I know all about different versions of classes/components, but developing process don't allow use that. So, this is not answer, why with FireDac can share connection (via CliHandle) with default transaction, but can't share other transaction using TFDTransaction object (or I don't know how to do t

Edited by: Dawid Najgiebauer on Mar 8, 2018 11:24 PM

check: http://docwiki.embarcadero.com/Libraries/Tokyo/en/FireDAC.Comp.Client.TFDCustomConnection.CliHandle

Because as It says, the CliHandle is not an object, it is only a pointer to the Connection already done by the DLL of the DBMS used by the TFDConnection. Remeber FD work with Database Owner API, so for example in Mysql, the connection are done my libmysql.dll, for each connection it returns a handle wich FD uses to communicate to the server, that is the handle that is shared via CliHandle.

In case of Delphi Each DLL and EXE hast their own memory manager when they are loaded into memory, I have never tried, but you dhould try to use the shared memory manager DLL from Borland. There is dll named BorlandMM.dll. Also add to your DPR (Both in DLL and EXE) the unit 'ShareMem', this unit has to be the first unit in the uses list. What it willl do is that both DLL and EXE will share the same memory manager, so the same Virtual table is used.

Also try FastMM4 in conjuntion with unit ShareMem and as a replacement of the legacy BorlandMM.dll

https://github.com/pleriche/FastMM4

for example

Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02