Re: Gtk2::MozEmbed + DOM




Torsten Schoenfeld said:
Gtk2::MozEmbed registers custom GTypes for the enums and the flags.

ah.  wasn't sure it registered all of them.  never mind.


If you
change CodeGen.pm to cast the value to the proper enum/flags type, it
works.  Patch attached.

doesn't hurt at all to do this in C, so i'd say it's a good thing in general.
should go into both HEAD and stable-1-08.


/usr/bin/perl5.8.6: symbol lookup error:
blib/arch/auto/Gtk2/MozEmbed/MozEmbed.so: undefined symbol:
_Z21gperl_register_objectmPKc

I've no idea what this is about.  Does the C++ linker need Glib.so to be
linked in explicitly?  And what about this weird symbol name?  Glib
doesn't define it.  Do you need to compile every module with c++ to make
it work?

that's a C++ versus C linkage issue.

in C++, all symbols are mangled to include information about their argument
lists.  this is to support overloading -- more than one function with the same
name but different parameters.

however, C functions are not mangled this way.

the C++ compiler is thinking that the function is the C++ function
::gperl_register_object, when it's actually a C function.

that's where C linkage comes in.

  extern "C" void foo ();

tells the C++ compiler to look for foo as foo, not ::foo.

the G_BEGIN_DECLS and G_END_DECLS macros in all of the gnome headers do this
wrapping for you.  looks like we need it in the gtk2-perl headers, as well.

the workaround, for now, is:

  /* this XS file will be compiled with a C++ compiler: */
  extern "C" {
    #include <gtk2perl.h>
  };



-- 
muppet <scott at asofyet dot org>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]