#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2004
    Posts
    10
    Rep Power
    0

    Question Exporting class from dll


    Hi,
    I'm trying to create dll that will contain datamodule. How can I export entire classes from dll, so I can attach db-aware components from main application to datasets existing in dll?
    Or perhaps I'm trying to do it completely wrong way?

    Any help will be appreciated.
    Thanks
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2004
    Posts
    93
    Rep Power
    11
    I'm not sure about this but using packages (.bpl) seems to be the way. The problem is how to get the class definition in your application so it can call the methods. Maybe a ancestor class should be used.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Oct 2000
    Location
    Back in the real world.
    Posts
    5,966
    Rep Power
    191
    I don't think it is possible to export classes from a DLL, but my knowledge in this area might be outdated. I haven't dealt with DLLs for quite some time.
    Reason:
    The format of DLLs is defined by windows OS. DLLs contain functions (not objects or classes) which are being exported in a C declaration style (not C++). i.e. one pointer per function (not two - you need two pointers to export methods, one for the object instance and one for the method)

    So you could instanciate an object in your DLL and export its methods, but you cannot export classes.

    I THINK BUT I AM NOT SURE!

    The problem is not unique to Delphi. You will most likely get more accurate answers if you post the same question (regarding C++) to the C forums. There's the guys who really know their sh1t, believe me! ...

    M.
    Last edited by M.Hirsch; December 25th, 2004 at 01:00 AM.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2004
    Posts
    93
    Rep Power
    11
    Actually using BPL allows you to share forms. I suddently remembered that I did create a form library before. I created a wrapper function that instantiates and return a instance of a form. I set the Application object, pass the object to a TFrame variable and it works. However, I need to use borlandmm to use these frames.

    I don't have Delphi or BCB installed so I can't tell you exactly how.

IMN logo majestic logo threadwatch logo seochat tools logo