Re: [gnome-love] call a function on a different compilation unit



On Mon, Apr 27, 2015 at 08:06:46PM -0600, julio wrote:
Hi,

Hi.

I am trying to solve an issue on gnome photos and now I am thinking
that it could be fixed by calling a function inside
photos-searchbar.c the thing is that this function takes as
parameter an object (you guessed!) PhotosSearchbar, actually a
pointer to an object of that Class... and all the functions inside
that file are static functions, as someone said I can not call a
function of that file from another .c file is there a way around
this? another thing is that there is no reference to the
PhotosSearchbar object on the photos-embed.c file, so I can not pass
it as an argument either...

any help or guidance is appreciated

If the function expects an object of that class then you should only
call it in the context of an object of that type. If you want to call it
in the context of another class and the function is fairly small then
you may want to consider just copying it to your class, or refactor the
shared code so that both classes can use it. If the code is generic
enough that both classes can use it, then maybe there is a better place
to put that code.

                Marcus



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