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

Jonathan Pryor jonpryor at vt.edu
Mon Aug 9 21:06:26 EDT 2004


On Mon, 2004-08-09 at 18:20, Ioannis Vranos wrote:
> Thank you for your useful email! I will stick in the C++/CLI code and
> not use managed extensions for consistency and convenience.

C++/CLI is just another name for Managed Extensions, though with a nicer
syntax.  For example, "__gc class" becomes "ref class".  The goal is the
same: to permit C++ syntax and semantics to be used on the .NET
platform.

> The Hello world program, as specified in the current C++/CLI draft
> (version 1.5):
> 
> int main()
> {
>     System::Console::WriteLine("Hello World");
> }
> 
> 
> C:\c>cl /clr:safe temp.cpp

<snip/>

> root at chrome cdrom]# mono temp.exe
> 
> ** (temp.exe:1416): WARNING **: Could not find assembly
> Microsoft.VisualC, references from /mnt/cdrom/temp.exe
> (assemblyref_index=1)
>      Major/Minor: 8,0
>      Build:       1200,0
>      Token:       b03f5f7f11d50a3a
> 
> cannot open assembly temp.exe

<snip/>

> Any ideas?

Evidently the default compiler flags insert an assembly reference to
Microsoft.VisualC.dll.  If you could run ILDASM.EXE on the assembly and
send us the resulting .il, that would be useful.  (I forget the correct
flags to use to generate the .IL file; just have it spit out as much
information as possible.)

The *real* question would remain after seeing the .il: How do you remove
the reference to Microsoft.VisualC.dll?  I have no idea, though I assume
the compiler documentation would mention it.

Alternatively, and a parallel solution, is to implement the
Microsoft.VisualC.dll assembly and contribute it to Mono.  This would
allow easier use of C++/CLI programs in the future, as developers
wouldn't need to worry about removing the assembly reference.  This is
similar to how Mono provides a Microsoft.VisualBasic.dll assembly for
VB.NET programs.

 - Jon





More information about the Mono-devel-list mailing list