"Vinu" <vinuwarrier@yahoo.com> writes:[color=blue]
> Thanks for your suggestion and advice. I will try to redefine the
> problem statement.
>
> The application on Solaris Sparc expects wide characters for its
> processing. One of the way of passing the wide characters will be pass
> it through the 'int main(int argc, wchar_t* argv[])'. Is there any
> alternative way of doing it?[/color]
What makes you think that you can declare main like that and have it
work? C's main() function takes two arguments, int argc and
char **argv (or, equivalently, char *argv[]).
If you declare it to take different types of arguments, it's quite
possible that the compiler won't complain, but when environment
invokes your program it will still attempt to pass it an int and a
char**. In effect, you're lying to the compiler. What happens next?
[color=blue]
> While using the former way and passing the command line arguments to
> the main function, we got bus error core dump while trying to access
> the command line arguments as wide character strings.[/color]
That's right, you get undefined behavior.
[...]
[color=blue]
> We have also tried to change main to wmain but it gives 'undefined
> symbol main' 'ld: fatal: Symbol referencing errors. No output written
> to <application name>' during linking.[/color]
That's right, because "wmain" is not a standard identifier in C.
[color=blue]
> Can you suggest standard way of doing it on Sun Solaris Sparc? We are
> using gcc 3.4.2 .[/color]
There may be no way to do what exactly what you're trying to do. A
compiler is allowed to support declarations for main() other than the
standard ones, but as far as I know gcc does not.
If you want to get Unicode strings into your program, you'll just have
to find a different way to do it. The most obvious is to use a UTF-8
encoding.
--
Keith Thompson (The_Other_Keith)
kst-u@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.