Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamically loading modules

Status
Not open for further replies.

milner

Programmer
Apr 15, 1999
28
CA
Hi,

I'd like to make a project that can be modular in nature. I want to be able to add code modules AFTER I've compiled the main program.

This is what I was thinking: Every module will have a set of interface functions that are called in the same manner for every module by the main program. Every module must have these functions.

The Question... What can I use for my modules?? I was thinking DLLs but I don't know if they can be loaded dynamically at run time.

I want to be able to put all the modules in a directory and just by using their filenames, load them and run their functions.

Is this possible?? Is my method possible? Does anyone know a better/easier way to do this?

Thanks

- Mike -
 
> Is this possible??

Yes, it's done all the time.

> Is my method possible?

Yes

> Does anyone know a better/easier way to do this?

You can use COM as well as a straight DLL.

Good luck
-pete
 
ok, so using straight DLL, How do I iterate between the folder of DLL files? Actually, first, how do I dynamically link to the DLLs? Do I need to make one first so my project will actually compile??

If you have any basic direction you can give, that'd be great.

Thanks,

Mike
 
Mike,

To dynamically link to DLL's you need learn how to use the following API's:

LoadLibrary()
GetProcAddress()

There are many articles and samples on MSDN.

> How do I iterate between the folder of DLL files?

I have no idea what that means.

-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top