Exporting functions in the Exe-File
Posted: Thu Jan 18, 2007 3:11 pm
Hi,
as here are many people around, who might know
if the following approach is complete bullsh*t or just nice...
It is possible to export a function in the main program, eg.:
My question is the following:
What happens to code like this:
If many Plugins link to this exported function, do they all get a reference to the same instance of TestClass?
Or does each library get its own reference?
The following approach I have in mind:
EXE-File loads a external library (dll plugin),
the dll tries to link to the exported function with GetProcAddress and
calls this function.
Regards
Marc
as here are many people around, who might know
if the following approach is complete bullsh*t or just nice...
It is possible to export a function in the main program, eg.:
Code: Select all
program Test;
procedure Test;
begin
DoSomething;
end;
exports
Test;
begin
Test;
end.
My question is the following:
What happens to code like this:
Code: Select all
program Test;
type
TTestClass = class
procedure DoSomeThing;
end;
var
TestClass: TTestClass;
procedure Test;
begin
TestClass.DoSomething;
end;
exports
Test;
initialization
TestClass:= TTestClass.Create;
finalization
FreeAndNil(TestClass);
begin
Test;
end.
If many Plugins link to this exported function, do they all get a reference to the same instance of TestClass?
Or does each library get its own reference?
The following approach I have in mind:
EXE-File loads a external library (dll plugin),
the dll tries to link to the exported function with GetProcAddress and
calls this function.
Regards
Marc