Create DLL, import in main application

  • Thread starter Thread starter Andy
  • Start date Start date
A

Andy

Hi!

I have a main application here and developed 2 modules as DLL files,
which will be updated from time to time.
The main application ships without the modules so i want to be able, to
put the module DLLs in application folder and call them from the main
application.

My question: is it possible to use my modules like that? The DLL files
would have a determined format like company.modulename.dll and the start
function could have the same name in all modules. Is there any way?

If necessary I could write an XML file which contains all module names
and the names of it dll files to load them into the main application.

Please help!

Thanks,
Andy
 
Andy said:
I have a main application here and developed 2 modules as DLL files, which
will be updated from time to time.
The main application ships without the modules so i want to be able, to
put the module DLLs in application folder and call them from the main
application.

My question: is it possible to use my modules like that? The DLL files
would have a determined format like company.modulename.dll and the start
function could have the same name in all modules. Is there any way?

Yes. It is not the easiest thing in the world to do. Here is a _sketch_ of
one way to go: You can use

Reflection::Assembly::LoadFrom()

to load the DLLs.

If each of your DLLs has a class derived from a known base, for each of the
assemblies loaded above you could use

Assembly::GetTypes().

For each of the types (classes) in your assemblies you could use

Type::BaseType

to determine the base class. If that base class is the one that contains
your function, you could use

Type::GetMethod()

to get information about the function and then

MethodInfo::Invoke()

to call it.

Regards,
Will

P.S. I have used MC++ syntax (::) to separate namespace, class and method
names
 
Back
Top