Re: [Vala] 'const' in string parameter




if the function receives a char* then it is a "ref string s" or "out string s", string is obviously const, because the function will not modify it. You can also use directly
pointers using "char*", but "ref char s" is wrong.

Viktor Semykin wrote:
Hi everyone.

I'm new to vala and I'm sorry in advance for noob question.

I need to define function with "char*" parameter to use as C library callback. When I try to define

public static void my_method (string s);

it generates "const char* s" so compiler is confused with different definitions and fails to compile. I found a workaround for this case

public static void my_method (ref char s);

but I dont like it.

Is there a way to get rid of 'const'?
_______________________________________________
Vala-list mailing list
Vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list





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