[Mono-docs-list] Question about EXE binaries and kernels?

Aaron Weber aaron@ximian.com
Tue, 06 Apr 2004 17:57:17 -0400


--=-OhWSlNuIVoC6qiZjSbq6
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Thanks for the explanation. How's this sound?


The normal way to run a Mono application is to invoke it through the
interpreter, like so:


mono myprogram.exe


However, there are two things you can do to make it more convenient to
run Mono applications. The first is to use a shell script instead of the
EXE file. For example, if you had "myprogram.exe" you could create a
shell script called "myprogram" that had the contents: 


       #!/bin/sh
       /usr/bin/mono myprogram.exe
     


If you installed mono to a different location, substitute that
for /usr/bin/mono. You can check with the "which mono" command. 

You can also make a systemwide change, and use binfmt to register the
exe files as non-native binaries. Then, when trying to launch an exe
file, the kernel will run the mono interpreter to handle the command.
Binfmt can also be used to launch Windows executables using WINE, or
Java .class files using a JVM. To register exe with the kernel: 


     1. Turn on binfmt in your kernel.
     2. Add the line below to your fstab: 
        
        binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc none
        
     3. Then, have your system run the following command on boot: 
        
        echo ':CLR:M::MZ::/usr/bin/mono:' > /proc/sys/fs/binfmt_misc/register
        
     4. Be sure to mark your .exe files as executable in the filesystem
        as well:
        
        chmod +x myprogram.exe

--=-OhWSlNuIVoC6qiZjSbq6
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/3.1.11">
</HEAD>
<BODY>
Thanks for the explanation. How's this sound?<BR>
<BR>
<BR>
The normal way to run a Mono application is to invoke it through the interpreter, like so:<BR>
<BR>
<PRE>
mono myprogram.exe
</PRE>
<BR>
However, there are two things you can do to make it more convenient to run Mono applications. The first is to use a shell script instead of the EXE file. For example, if you had &quot;myprogram.exe&quot; you could create a shell script called &quot;myprogram&quot; that had the contents: <BR>
<BR>
<PRE>
       #!/bin/sh
       /usr/bin/mono myprogram.exe
     
</PRE>
<BR>
If you installed mono to a different location, substitute that for /usr/bin/mono. You can check with the &quot;which mono&quot; command. <BR>
<BR>
You can also make a systemwide change, and use binfmt to register the exe files as non-native binaries. Then, when trying to launch an exe file, the kernel will run the mono interpreter to handle the command. Binfmt can also be used to launch Windows executables using WINE, or Java .class files using a JVM. To register exe with the kernel: <BR>
<BR>
<OL TYPE=1>
    <LI TYPE=1 VALUE=1>Turn on binfmt in your kernel.
    <LI TYPE=1 VALUE=2>Add the line below to your fstab: <BR>
<PRE>
binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc none
</PRE>
    <LI TYPE=1 VALUE=3>Then, have your system run the following command on boot: <BR>
<PRE>
echo ':CLR:M::MZ::/usr/bin/mono:' &gt; /proc/sys/fs/binfmt_misc/register
</PRE>
    <LI TYPE=1 VALUE=4>Be sure to mark your .exe files as executable in the filesystem as well:<BR>
<PRE>
chmod +x myprogram.exe
</PRE>
</OL>
</BODY>
</HTML>

--=-OhWSlNuIVoC6qiZjSbq6--