Re: gmodule question



Hello,

On Mon, May 17, 2010 at 2:55 AM, Lex Trotman <elextr gmail com> wrote:
> On 17 May 2010 00:05, Kurucz István <kurucz istvan gmail com> wrote:
>> On Sun, May 16, 2010 at 11:51 AM, Lex Trotman <elextr gmail com> wrote:
>> > On 16 May 2010 19:45, Kurucz István <kurucz istvan gmail com> wrote:
>> >> On Sun, May 16, 2010 at 3:27 AM, Lex Trotman <elextr gmail com> wrote:
>> >> > On 16 May 2010 06:56, Kurucz István <kurucz istvan gmail com> wrote:
>> >> >> I would use a string in my modul
>> >> >>
>> >> >> in my module:
>> >> >> G_MODULE_EXPORT extern const gchar *foobar_name = "foobar";
>> >> >>
>> >> >>
>> >> >> in main application:
>> >> >>
>> >> >> gchar* test;
>> >> >> g_module_symbol(module, "foobar_name", (gpointer*)&test);
>> >> >
>> >> > Assuming you opened module and tested the return??
>> >> >
>> >> > Now test the return of g_module_symbol and use g_module_error to find
>> >> > out
>> >> > the error.
>> >>
>> >> Yes, module opening is success. g_module_error() result has nothing
>> >> special. It works fine with functions, but I cannot access other
>> >> symbols (eg. variables).
>> >>
>> >>
>> >
>> > You mean that g_module_symbol returned true but the pointer was not the
>> > string?
>>
>> Yes, that's right!
>>
>> > If so you had better post the whole of a short program that demonstrates
>> > the problem.
>>
>> This is very little example:
>> http://dunaharaszti.lutheran.hu/glib_module_error_sample.tar.gz
>
> Type mismatch on module_text, its a gchar * in main which is set to the
> *address* of a gchar * in module, change module declaration to:
>
> G_MODULE_EXPORT extern gchar module_text[] = "This is module text!";
>
> then the gchar * in main gets the address of a gchar which matches.

Big Thanks, it's working! :)


Thanks:
Kurucz István


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