load a Class from a DLL ?

Started by
5 comments, last by Snatch 20 years ago
Is it possible with Visual Studio .Net to put a Class in a DLL and instance it an other executable ??? If it is possible at runtime, it it time consuming ? Can me apply this method to load every kind of object a game can use ? (CModel CSolidModel CSoundGenerator CSoundEnvironment ...)
Advertisement
I know it''s possible with C++, and $100 says it''s possible with any .net languages as well.

MindEngine Development
http://medev.sourceforge.net
Yes i am sorry, i speak about C++
Sure you can, just declare the class with __declspec(dllexport) in the dll and __declspec(dllimport) in the executable. I''m not sure how time consuming it is, but I expect its not too much of a performance hit.
Do you want to dynamically load it or use an import library?

If you want to do an import library, use what Duke said.

If you want to do it dynamically, you can do it with abstract interfaces

I normally use COM-style interfaces. (Otherwise your DLL will likely be exporting a zillion member functions from all the classes)
It shouldn''t be too time consuming (for modern processors).
See-Plus-Plus
There are a few ways of doing it. So yes, it is posible.

Maega advice works well. And if you go for the Abstract interfaces, then I can atest that it works, even when a C++ DLL is loaded by a Delphi App.



Armand
-------------------------
It is a good day to code.
Armand -------------------------It is a good day to code.

This topic is closed to new replies.

Advertisement