DELPHI AREA
MESSAGE BOARD
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Export classes from DLL

 
   Reply to topic    DELPHI AREA Forum Index -> Delphi Programming
View previous topic :: View next topic  
Author Message
jhynds
Member


Joined: 01 Oct 2003
Posts: 1
Location: UK

PostPosted: 01/10/03 14:41    Post subject: Export classes from DLL Reply with quote

I have several classes defined in an app and i want to be able to bundle them in a DLL and link to the Library to use the classes.
Can anyone suggest how i achieve this or point me towards a good tutorial/reference.

I also want to be able to use both threads and the win32 API in a DLL and am still unsure of the issues this will cause. A tutoiral for this would be great too.

Cheers

J
Back to top
View user's profile
Johnny_Bit
Junior Member


Joined: 15 Jun 2003
Posts: 80

PostPosted: 01/10/03 17:31    Post subject: Reply with quote

make sure that classes in aplication, and DLL are identical (maybe header file?) and from this point you can do whatever you like with classes.
Back to top
View user's profile
Behrooz
Member


Joined: 06 Oct 2003
Posts: 5

PostPosted: 06/10/03 06:33    Post subject: Exporting classes in a DLL Reply with quote

Hi,
A simple way for doing this is to write a unit that describes the class members and variables and let the procedures to be defined virtually (add the virtually keyword after defining a procedure or function) then use this unit in your DLL file and define a new class which inherites the named class, Last thing to be done is to define a function with result type of named class and return new class type and export this function. like this
(in first unit)
type
TNamedClass = class
...

(in your dll)
type
TDefClass = class of Definition;
TDefinition = class(NamedClass)
...
end;

export GiveDefClass;

function GiveDefClass:TDefClass;
begin
return TDefinition;
end;

I'll send a documented sample code as soon as I can.
Back to top
View user's profile
Display posts from previous:   
   Reply to topic    DELPHI AREA Forum Index -> Delphi Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB 2.0.6 © 2001, 2002 phpBB Group