0

I am interested in upgrading a suite of software from ODAC v5 to v8.2.8.

One app in particular is causing problems. This application loads one of a set of secondary applications implemented as dlls.

LibHandle := LoadLibrary(PChar(dllname));
if LibHandle <> 0 then
begin
  @showForm := GetProcAddress(LibHandle,'ShowMainDllForm');
  if (@showForm <> nil) then
  begin
    try
      ShowForm(Application.Handle, @FGlobalVars, 1);

The launcher is fine - it has its own database connection, and I can step through the various ODAC units fairly happily.

However, the dll immediately excepts on attempting to open a cursor. The error is an Assertion Failure in the unit DBAccess.pas, called from MemDs.pas. I have stepped through this and have shown that the assertion failure is correct; Assert(FieldDesc is TCRFieldDesc) is receiving a TFieldDesc from MemDS.CreateFieldDefs().

I am stumped. How can it be that one calling method works fine (the launcher app) and the other (the dll) always fails ?

If anyone has experienced difficulties in this area I would appreciate any information, however tenuous it might sound

TLama
  • 75,147
  • 17
  • 214
  • 392
Hugh Jones
  • 2,706
  • 19
  • 30
  • The code you have provided demonstrates loading of the library and invoking of the method from it, but not the implementation of the code causing the error. Please provide the full code of the main application, libraries and scripts for creating DB objects used in the library - and we will try to reproduce and fix the problem. – Devart Mar 19 '13 at 15:07
  • That sounds easier than it is, mainly because there is a whole bunch of component dependencies I would have to replicate. Your answer to my other question is informative ... I will get back to you. – Hugh Jones Mar 19 '13 at 16:48
  • @devart - I have demonstrated that taking off the assertion line resolves the problem. I suspect that typeinfo is being lost in the `AssignConnect` method. Are you able to comment? Messing with your code is not ideal for us, is there anything you can think of that has changed from version 5 that you think might be relevant ? – Hugh Jones Mar 20 '13 at 15:53

2 Answers2

1

We have already fixed this problem. You can either download the latest ODAC version 8.6.12 or modify the line invoking Assert:

in the TCustomDADataSet.GetFieldType method

replace 
  Assert(FieldDesc is TCRFieldDesc);
with
  Assert(IsClass(FieldDesc, TCRFieldDesc));
Devart
  • 119,203
  • 23
  • 166
  • 186
  • Fantastic! We are in the process of raising a purchase order to upgrade but this will see us through for now. Many thanks. – Hugh Jones Mar 21 '13 at 09:59
  • I have just been speaking to my colleague who advises me that he attempted to download 8.6 BEFORE our licensing period ran out. He was unable to find any way to download anything but a trial version from you. Are you able to assist us ? As I said before, we are renewing but this seems to be taking time. – Hugh Jones Mar 21 '13 at 10:42
  • If your subscription has expired, you should renew it to get access to the latest versions. You can update your subscription at our website devart.com/odac/ordering.html in the Subscription Renewals section the Renewals & Upgrades tab. You can download the trial version from our website: devart.com/odac/download.html . P.S. This problem was fixed in the version 8.5.10. If this version is available for you in Registered Users' Area, you can use it to solve the problem – Devart Mar 21 '13 at 14:45
  • Our supplier is contacting you because we didnt receive licensing keys. This means we cannot renew or download upgrades... At the time we purchased we found it was not possible to buy direct from you ... Can we take this discussion offline ? – Hugh Jones Mar 21 '13 at 16:03
  • All questions concerning licensing (restoring of registration information, updates, etc.) can be sent to us via the contact form at our website: http://www.devart.com/company/contact.html – Devart Mar 21 '13 at 16:18
  • I have already done that, but had no reply as yet. I have also been in touch with our UK supplier who is contacting you separately. – Hugh Jones Mar 21 '13 at 16:24
1

we use the DEVART MySQL, and SQL connectors. I have experienced the exact issue with the MySQL (MyDAC) connection. However, what I found was this: In the DBAccess.pas file, the above code change was already there;

Assert(IsClass(FieldDesc, TCRFieldDesc));

But I was still getting the same Assertion error. I stepped in a little further, and found in the CRFunctions unit, I made the following changes, and now my Server connection works perfectly from a dll file:

begin
  if IsLibrary then
    Result := IsClassByName(Obj, AClass)
  else
  //------------------------------------
  // Danny MacNevin : October 3,2013
  // commented out the below line to fix an Assertion Error 
  // using the TMyConnection in a dll file.
  // It was being called from the DBAccess.pas file at line: 7251
  // To put this file back to normal, remove the line I added, and 
  // uncomment the line below...
  //------------------------------------
  //Result := Obj is AClass;
    Result := IsClassByName(Obj, AClass) //Line replaced by Danny
end;