IDAPI hangs on Win3.x machines when sharing TTables through DLL's 
Author Message
 IDAPI hangs on Win3.x machines when sharing TTables through DLL's

Hello,

I have a DLL with the following procedure:

unit Dlltabu1;

interface

uses DBTables;

var aTable:TTable;

procedure AddRecord; export;

implementation

uses DB,Dialogs,SysUtils;

procedure AddRecord;
var Highest:LongInt;
begin
  TRY
    WITH aTable DO
    BEGIN
      IF RecordCount=0 THEN
        Highest:=0
      ELSE
      BEGIN
        Last;
        Highest:=FieldByName('MsgID').AsInteger;
      END;
      Append;
      FieldByName('MSGType').AsString:='O';
      FieldByName('MsgID').AsInteger:=Highest+1;
      Post;
    END;
  EXCEPT
    ON E:Exception DO
      ShowMessage('Exception message: '+E.Message);
  END;
end;

procedure DestroyTable; far;
begin
  IF aTable<>NIL THEN
  BEGIN
    aTable.Close;
    aTable.Free;
  END;
  aTable:=NIL;
end;

Initialization
  aTable:=TTable.Create(NIL);
  aTable.TableName:='TEST.DB';
  aTable.DatabaseName:='C:\';
  AddExitProc(DestroyTable);

end.

I also have an .EXE which calls the AddRecord procedure in the DLL.
Everything works until a second instance of this EXE is launched. When
two instances of this EXE are running, only the calls from the 1st
instance to AddRecord succeeds. The calls from the second instance raise
an exception on the first method call on the aTable variable in the DLL.
The exception generated is "Lock time out".

The strange thing is that this problem only occurs on Win3.x machines
and not on Win95 machines.

I have also copied the full idapi installation from the 95 machine to
the 3.11 machine, but to no avail. The problem persists on the Win3.11
machine. One thing I noted is that on the Win3.11 machine IDAPI
generates PARADOX.LCK and PDOXUSRS.LCK files in the root directory on
the first append. This does not happen on the WIN95 machine.

Does anybody know the reasons to this strange behaviour ?

--

------------------------------------------------------
Rik Gruwez


http://www.***.com/

"There is no substitute for cubes"
------------------------------------------------------



Sat, 18 Sep 1999 03:00:00 GMT
 IDAPI hangs on Win3.x machines when sharing TTables through DLL's

Quote:

> Hello,

> I have a DLL with the following procedure:

 [snip]

Quote:

> I also have an .EXE which calls the AddRecord procedure in the DLL.
> Everything works until a second instance of this EXE is launched. When
> two instances of this EXE are running, only the calls from the 1st
> instance to AddRecord succeeds. The calls from the second instance raise
> an exception on the first method call on the aTable variable in the DLL.
> The exception generated is "Lock time out".

> The strange thing is that this problem only occurs on Win3.x machines
> and not on Win95 machines.

> I have also copied the full idapi installation from the 95 machine to
> the 3.11 machine, but to no avail. The problem persists on the Win3.11
> machine. One thing I noted is that on the Win3.11 machine IDAPI
> generates PARADOX.LCK and PDOXUSRS.LCK files in the root directory on
> the first append. This does not happen on the WIN95 machine.

> Does anybody know the reasons to this strange behaviour ?

In the demos on the Delphi 1.0 CD they had one for using the bde vai a
dll. The explicitly stated that the DLL could only be used by on app at
a time. They took great pains to ensure that only on app used the dll at
a time.

There was also a bunch of code to ensure that the BDE was terminated
correctly after your app closed.

hope this helps

--

Robert Schieck
-----------------------------------------------------------------------
MER Systems Inc.   voice - 416-410-5166
                  fax    - 416-410-5167

Client/Server Development and Training using Delphi,  InterBase and
Oracle

home page            http://www.mers.com
InterBase page  http://www.mers.com/interbase.html
udflib page     http://www.mers.com/product.html
TDUG page       http://www.mers.com/tdug.html      -Toronto Delphi Users Group



Sat, 18 Sep 1999 03:00:00 GMT
 IDAPI hangs on Win3.x machines when sharing TTables through DLL's

Quote:

> In the demos on the Delphi 1.0 CD they had one for using the bde vai a
> dll. The explicitly stated that the DLL could only be used by on app at
> a time. They took great pains to ensure that only on app used the dll at
> a time.

> There was also a bunch of code to ensure that the BDE was terminated
> correctly after your app closed.

> hope this helps

> --

> Robert Schieck

Hi Robert,

Thanks for your advice. I'll have to checkt the demos on the CD. My
problem is not entirely solved, however. What is the reason that the
same application with DLL table sharing DOES work on Windows 95
machines. To avoid any misunderstanding: the Win95 machine is running
under 16 bit IDAPI and the application has been compiled on a Win3.11
machine using Delphi 1.0. So, as a matter of fact, there is no
difference between coding on the two systems. Still, the application
does not hang when running on Win95.

Thanks for your help.

Rik
--

------------------------------------------------------
Rik Gruwez


http://uc2.unicall.be/gruwez

"There is no substitute for cubes"
------------------------------------------------------



Mon, 20 Sep 1999 03:00:00 GMT
 
 [ 3 post ] 

 Relevant Pages 

1. INGRES W4GL on DOS/Win3 - Parameter Passing to DLL's

2. ADO's Open method can hang if used in a DLL

3. TTables/TQueries in dll?

4. Shared DLL's

5. CTL3DV2.DLL disappearing from client's machine

6. BUGS idapi BUGS idapi BUGS idapi BUGS

7. Q: Shared database connect between DLL's

8. FP3 hangs on Win3.1

9. Pdox45 on Win3.1 to a Win95 machine problems

10. Error registering dll 'msado15.dll'

11. Using TTables, GPF's

12. Cannot load the DLL 'dllname.dll'.


 
Powered by phpBB® Forum Software