[pypy-svn] r40440 - pypy/dist/pypy/translator/cli

antocuni at codespeak.net antocuni at codespeak.net
Tue Mar 13 15:44:18 CET 2007

Author: antocuni
Date: Tue Mar 13 15:44:16 2007
New Revision: 40440

Use the real name of the executable instead of "" for argv[0]. This is
not the same behaviour as we have in C because in .NET there is no way
to know the exact command line that started the process, so its value
is always the absolute path referring to the exe. Still better than

Modified: pypy/dist/pypy/translator/cli/entrypoint.py
--- pypy/dist/pypy/translator/cli/entrypoint.py	(original)
+++ pypy/dist/pypy/translator/cli/entrypoint.py	Tue Mar 13 15:44:16 2007
@@ -42,9 +42,10 @@
         ilasm.begin_function('main', [('string[]', 'argv')], 'void', True, 'static')
         ilasm.new('instance void class [pypylib]pypy.runtime.List`1<string>::.ctor()')
-        # fake argv[0]        
+        # fake argv[0]
-        ilasm.opcode('ldstr ""')
+        ilasm.call('class [mscorlib]System.Reflection.Assembly class [mscorlib]System.Reflection.Assembly::GetEntryAssembly()')
+        ilasm.call_method('string class [mscorlib]System.Reflection.Assembly::get_Location()', True)
         ilasm.call_method('void class [mscorlib]System.Collections.Generic.List`1<string>::Add(!0)', True)
         # add real argv

More information about the Pypy-commit mailing list