Re: Connecting to a signal given as a string



On Sun, 2008-10-26 at 13:11 +0000, Chris Vine wrote:
> Either your object whose 'this' pointer you passed in no longer exists
> when the callback is executed, or your on_load_finished() method is
> defective in some way. What does the debugger show?
> 
> Actually there is another issue, which will not bite if you are using
> gcc, namely that your on_page_loaded() function will have C++ linkage.
> It is better to declare it extern "C". which means you then need to
> put
> it in anonymous namespace in order for it not to be exported.
> Something
> like:
> 
> namespace {
> extern "C" {
> void on_page_loaded (WebView *web_view)
> {
>   web_view->on_load_finished ();
> }
> } // extern "C"
> } // anonymous namespace

extern "C" is useless here because there is no linkage here. The only
thing extern "C" does is to change the symbol mangling and forbid
overloading to be able to call functions from C code (whose reference
will be resolved at link time).


Hub



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