|
|
Home » U++ Library support » U++ Library : Other (not classified elsewhere) » "All shared" in Windows question
|
|
|
|
Re: "All shared" in Windows question [message #18678 is a reply to message #18674] |
Thu, 16 October 2008 09:59 |
Mindtraveller
Messages: 917 Registered: August 2007 Location: Russia, Moscow rgn.
|
Experienced Contributor |
|
|
Yes, it seems like "all shared" is truly a POSIX specific. Still we know that memory manager problem (main app / plugin) is solved by using U++ Core as dynamic library. I searched this forum and came to conclusion that there is no way to make U++ Core DLL-based without applying hacks. This makes classic plugin approach unworkable with U++.
There is one bigger issue with U++ versioning. Let`s imagine we managed to compile U++ libs as DLLs, wrote main application and released some number of U++ plugins for it. Then we distribute them and people start using our application.
After some time passed, we`ve decided to upgrade some plugins and added a pair of new ones. This time, we have U++ with newer version than one in DLLs distributed. And our newly written plugins will most likely crash on user machines where old U++ Core DLLs are resided.
This all means that each DLL should be standalone with U++ libraries statically linked. Yes, it is the hard way, but it is more likely the only way because of problems with U++ core libraries` dynamic linking and rapid U++ growth.
[Updated on: Thu, 16 October 2008 10:00] Report message to a moderator
|
|
|
|
|
|
|
|
|
Re: "All shared" in Windows question [message #18836 is a reply to message #18711] |
Sun, 26 October 2008 02:18 |
Mindtraveller
Messages: 917 Registered: August 2007 Location: Russia, Moscow rgn.
|
Experienced Contributor |
|
|
The main question here is if Core DLL will solve all the problems with memory management.
Finally I have a pair of little sample plugin apps. Both GUI. First application is linked into DLL and has 2 functions like Start and Finish. It is common U++ GUI project, with main window Execute() called from Start();
Second application is U++ EXE and loads this DLL dynamically with LoadDll__. Loading is successful, but when I call DLL`s Start() function, an exception is thrown. I thought it would not be a problem. In theory these modules have different memory managers and no problems should appear. What is done wrong here?
[Updated on: Sun, 26 October 2008 02:30] Report message to a moderator
|
|
|
|
Re: "All shared" in Windows question [message #18839 is a reply to message #18838] |
Sun, 26 October 2008 09:55 |
Mindtraveller
Messages: 917 Registered: August 2007 Location: Russia, Moscow rgn.
|
Experienced Contributor |
|
|
///////MAIN EXE
typedef void (* PlugFunc)();
struct Plugin
{
PlugFunc plugStart, plugFinish;
bool activated;
DLLHANDLE handle;
Plugin() :plugStart(0), plugFinish(0), activated(false) {}
void Start() {plugStart();}
};
Array<Plugin> plugins;
AdvPlugTest::AdvPlugTest()
{
::CtrlLayout(*this);
plugStart <<= THISBACK(PluginStart);
plugList.AddColumn("Íàéäåíû ïëàãèíû");
FindFile ff(DIR_PLUGINS+"*.dll");
while (ff)
{
plugList.Add(ff.GetName());
ff.Next();
Plugin newPlugin;
String pluginName = DIR_PLUGINS+ff.GetName();
static const char *const names[3] = {"PlugStart", "PlugFinish",0};
void * procs[] = {&newPlugin.plugStart,&newPlugin.plugFinish,0};
newPlugin.handle = LoadDll__(pluginName, &names[0], &procs[0]);
plugins.Add(newPlugin);
}
}
void AdvPlugTest::PluginStart()
{
int row = plugList.GetClickRow();
if (row<0 || row>=plugList.GetCount())
row = 0;
if (plugins[row].activated)
return;
plugins[row].activated = true;
plugins[row].Start();
}
///////DLL
Plug *plug = 0;
extern "C"
{
DLLEXPORT void PlugStart();
DLLEXPORT void PlugFinish();
};
extern "C" void PlugStart()
{
plug = new Plug();
plug->Execute();
}
extern "C" void PlugFinish()
{
delete plug;
}
Plug::Plug()
{
::CtrlLayout(*this, "Plugin window");
}
[Updated on: Sun, 26 October 2008 09:57] Report message to a moderator
|
|
|
|
|
|
|
Re: "All shared" in Windows question [message #19207 is a reply to message #18641] |
Thu, 20 November 2008 11:11 |
Factor
Messages: 5 Registered: June 2007 Location: Hungary
|
Promising Member |
|
|
I was able to compile the upp packages to shared lib with mingw 4.3 on windows (some minor changes needed only). During compilation the following warning message appears:
Info: resolving vtable for Upp::ImageEncoder by linking to __imp___ZTVN3Upp12ImageEncoderE (auto-importd:/prg/mingw/bin/../lib/gcc/mingw32
/4.3.0/../../../../mingw32/bin/ld.exe: warning: auto-importing has been activated without --enable-auto-import specified on the command line.
This should work unless it involves constant data structures referencing symbols from auto-imported DLLs.)
I've tested a lot of applications in the reference and example directory and all works as excepted.
My question is that how usable this method in a real world application that uses shared libs as plugins?
|
|
|
Goto Forum:
Current Time: Thu Jun 06 08:04:31 CEST 2024
Total time taken to generate the page: 0.01971 seconds
|
|
|