[Mono-devel-list] Issue of binary portability of a hello world application

Jonathan Pryor jonpryor at vt.edu
Tue Aug 10 07:33:16 EDT 2004


On further consideration, it occurs to me that the problem *may* be that
the C++/CLI program isn't fully managed.  Strings are still ANSI by
default, not managed, and attempting to pass "Hello World" to
System::Console::WriteLine will require converting the C string into a
System.String first.

This should be possible via the System.String(byte*) constructor, but
CL.EXE may be using a Microsoft.VisualC.dll function instead.  We'd have
to see the disassembled program to be sure.

You might try using fully managed strings instead.  This is done by
prefixing "S" to the string, e.g. S"Hello World":

	int main()
	{
	    System::Console::WriteLine(S"Hello World");
	}

 - Jon





More information about the Mono-devel-list mailing list