December 20th, 2004, 02:07 AM
Exporting class from dll
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.
December 23rd, 2004, 10:38 PM
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.
December 25th, 2004, 12:58 AM
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.
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! ...
Last edited by M.Hirsch; December 25th, 2004 at 01:00 AM.
December 25th, 2004, 08:58 AM
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.