Discussion:
application needs one of 2 DLLs
(too old to reply)
Sonnich Jensen
2012-02-28 15:25:32 UTC
Permalink
Hi

In an update I need to use the DLL present - and it is simple.
One is present, the other not.

The idea is to create a class which uses the DLL and if it fails it is
not there.
Now I see that Delphi really wants the DLL to be there at all
times...

How can I achieve this?

An exmalple:

TMyClass = class;

TMyClass1 = class(TMyClass);
... uses DLL1
TMyClass2 = class(TMyClass);
... uses DLL2

var
aa: TMyClass
try
aa: = TMyClass1,Create
except
// not present
aa: = TMyClass2,Create
// eventually some more checking here but you should get the idea
here...
end;
Maarten Wiltink
2012-02-28 17:06:25 UTC
Permalink
Post by Sonnich Jensen
In an update I need to use the DLL present - and it is simple.
One is present, the other not.
The idea is to create a class which uses the DLL and if it fails it is
not there.
Now I see that Delphi really wants the DLL to be there at all
times...
How can I achieve this?
LoadLibrary.

Groetjes,
Maarten Wiltink
Jamie
2012-02-28 22:53:34 UTC
Permalink
Post by Sonnich Jensen
Hi
In an update I need to use the DLL present - and it is simple.
One is present, the other not.
The idea is to create a class which uses the DLL and if it fails it is
not there.
Now I see that Delphi really wants the DLL to be there at all
times...
How can I achieve this?
TMyClass = class;
TMyClass1 = class(TMyClass);
... uses DLL1
TMyClass2 = class(TMyClass);
... uses DLL2
var
aa: TMyClass
try
aa: = TMyClass1,Create
except
// not present
aa: = TMyClass2,Create
// eventually some more checking here but you should get the idea
here...
end;
you must use LoadLib at run time. if it fails, then it does not exist..

Jamie

Loading...