I have a pretty substantial C# program currently. I have been pondering a rewrite of it to C++ using SDL/OpenGL. Currently, the C# program has a separate project within it (Framework) that encompasses a lot of classes to it (IE: BaseControl, DerivedButton, DerivedLabel, etc). There is also a plugin structure to load .dll's. The premise is that others can make a "Panel" and layout the exposed controls to it. The core program then renders any active "Panel".
For the past couple of weeks I have been doing tons of research on a plugin structure/architecture within C++.
http://www.codeguru.com/cpp/misc/misc/plug-insadd-ins/article.php/c3879/Plugin-Architecture-Framework-for-Beginners.htm
http://blog.nuclex-games.com/tutorials/cxx/plugin-architecture/
http://www.abstraction.net/ViewArticle.aspx?articleID=67
And various StackOverflow pages.
I have yet to understand if I can keep my design from the previous project. So far I am led to believe that I can only export functions that are not within a class or else the names become mangled.
Is there a design where I can give users the ability to link to my framework project and use exposed classes (label, button, etc) so they can make their own panels that I can render.
The plugin structure ideally only needs to expose an Initialize method which I can call. Each plugin can do whatever in that method, such as creating a "Panel" and some buttons on it. Then the core program would load that panel and when it's displayed it would render it. If I can't expose controls with correct names how can the framework be used by others?
Currently a C# plugin could do something like this after referencing the framework:
1 2 3 4 5 6 7
|
Public void Initialize()
{
Panel p = new Framework.Controls.Panel("Name");
Button b = new Framework.Controls.Button("Name", x, y, w, h);
p.AddControl(b);
Framework.PanelManager.Load(p);
}
|
The reason for moving to C++ is to become cross-platform compatible. I know there is Mono and such but I'd rather go lower level and not rely on others having to use Mono. Plus my controls via OpenGL code are fun!
EDIT: Forgot to add that I am aware of the difference between loading .dll's and .so's. I found this which is a great reference:
http://www.yolinux.com/TUTORIALS/LibraryArchives-StaticAndDynamic.html