Board index » delphi » Problem with TCollection and DLLs

Problem with TCollection and DLLs

Hello,

  I've got this problem about collections and DLLs. I've made a collection
in my program and operations runs correctly. But when I give as a parametr
to a procedure into a DLL's procedure and then run any method of that
collection, it stops on a General protection fault.
  Does anybody know about this problem, and about some way how to
run correctly? I'm afraid there's a problem about the way main program
and DLLs use the memory, but I've got no knowledge about it.
  The DLLs are made corectly, without this it runs OK.

        Thank you
                  Honza

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  The way the program runs is:

---

unit Coll;
(...)
PDataColl = ^TDataColl;
TDataColl = object (TCollection)

(...)

var  Coll1 : TDataCollection;

---

library WinCom;

procedure GetData (var t : TDataCollection);
  with t do
   (...)           {here it falls down}

---

program JCW;

  with Coll1 do
    (...)          {runs OK}
  XX (Coll1);

-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-

        |^^^|                     Jan Kohout (HoK)
       / o   \                    e-mail : xkoho...@fi.muni.cz
     <        \_____/__           http://www.fi.muni.cz/~xkohout2
       \          / \             snail : Armenska 1, Brno, Czech Republic
        \_______/                 tel : 00420 - 5 - 47 24 08 29
          |   |
         /|\ /|\        
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  Pomozte vymytit smrt z nasich silnic - jezdete po chodniku!

 

Re:Problem with TCollection and DLLs


In article <Pine.LNX.3.96.990308140912.29717C-100...@nymfe06.fi.muni.cz>

Quote
Jan Kohout <xkoho...@fi.muni.cz> wrote:
> Hello,

>   I've got this problem about collections and DLLs. I've made a collection
> in my program and operations runs correctly. But when I give as a parametr
> to a procedure into a DLL's procedure and then run any method of that
> collection, it stops on a General protection fault.

Where is the collection being instantiated? If it is in
the calling program, than you will have problems passing it as a
parameter to a DLL. You can try using a pCollection parameter
in the DLL, instead of a TCollection "var" parameter (i.e, pass a
pointer to a TCollection, or, pass the address of a TCollection instance)-
but I am not sure that even this will work.

Best regards, The Chief
--------
Dr. A{*word*73}la A. Olowofoyeku (The African Chief)
Email: la...@keele.ac.uk
Homepage: http://ourworld.compuserve.com/homepages/African_Chief/
Author of: Chief's Installer Pro v5.00 for Win32
     ftp://ftp.simtel.net/pub/simtelnet/win95/install/chief500.zip

Other Threads