| View previous topic :: View next topic |
| Author |
Message |
jhynds Member
Joined: 01 Oct 2003 Posts: 1 Location: UK
|
Posted: 01/10/03 14:41 Post subject: Export classes from DLL |
|
|
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 |
|
 |
Johnny_Bit Junior Member
Joined: 15 Jun 2003 Posts: 80
|
Posted: 01/10/03 17:31 Post subject: |
|
|
| 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 |
|
 |
Behrooz Member
Joined: 06 Oct 2003 Posts: 5
|
Posted: 06/10/03 06:33 Post subject: Exporting classes in a DLL |
|
|
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 |
|
 |
|