On 18.03.2010, at 12:39, Albrecht Schlosser wrote:
>
> Output from test/cube:
>
> (1) Cygwin with mingw-runtime 3.15:
>
> $ test/cube
> Fl_Plugin: creating a plugin, class "fltk:device", name
> "opengl.device.fltk.org"
> Fl_Plugin: creating a plugin manager for class "fltk:device"
> Fl_Plugin: adding plugin named "opengl.device.fltk.org" at 0x004660B0
> Fl_Plugin: deleting a plugin manager
> Fl_Plugin: creating a plugin manager for class "fltk:device"
> Fl_Plugin: returning plugin named "opengl.device.fltk.org": 0x00000000
^^ so this line means that the plugin is actually registered and found, only
that the plugin base address is set to 0x0.
Looking at the code, I seem to remember that %p as a format identifier in
sscanf may be an issue. Here are the two functions that set and read the
address of the plugin. May Cygwin has limited support here? If so, how should I
write a pointer in ASCII instead? I can of course manually convert it to/from
Hex?!
/**
* \brief Return the address of a plugin by name.
*/
Fl_Plugin *Fl_Plugin_Manager::plugin(const char *name)
{
char buf[32];
Fl_Plugin *ret = 0;
if (groupExists(name)) {
Fl_Preferences pin(this, name);
pin.get("address", buf, "@0", 32);
sscanf(buf, "@%p", &ret);
#ifdef FL_PLUGIN_VERBOSE
printf("Fl_Plugin: returning plugin named \"%s\": 0x%p\n", name, ret);
#endif
return ret;
} else {
#ifdef FL_PLUGIN_VERBOSE
printf("Fl_Plugin: no plugin found named \"%s\"\n", name);
#endif
return 0L;
}
}
/**
* \brief This function adds a new plugin to the databse.
*
* There is no need to call this function explicitly. Every Fl_Plugin
constructor
* will call this function at initialization time.
*/
Fl_Preferences::ID Fl_Plugin_Manager::addPlugin(const char *name, Fl_Plugin
*plugin)
{
char buf[32];
#ifdef FL_PLUGIN_VERBOSE
printf("Fl_Plugin: adding plugin named \"%s\" at 0x%p\n", name, plugin);
#endif
Fl_Preferences pin(this, name);
snprintf(buf, 32, "@%p", plugin);
pin.set("address", buf);
return pin.id();
}
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev