2009-10-28 16 views
0

Je suis sur Windows et j'essaye de compilation à l'avance sur Main.exe qui a été compilé avec le compilateur Mono C# gmcs (également essayé mcs).mono AOT sur Windows exe me donne une DLL

>mono --aot Main.exe 
Mono Ahead of Time compiler - compiling assembly C:\test\Main.exe 
Code: 21 Info: 4 Ex Info: 8 Class Info: 30 PLT: 2 GOT 
Info: 6 GOT Info Offsets: 8 GOT: 12 
Executing the native assembler: as C:\DOCUME~1\MigueldeIcaza\LOCALS~1\Temp\mono_aot_D2 ID2U -o C:\DOCUME~1\MigueldeIcaza\LOCALS~1\Temp\mono_aot_D2ID2U.o 
Executing the native linker: gcc -shared --dll -mno-cygwin -o C:\test\Main.exe.dll C:\DOCUME~1\MigueldeIcaza\LOCALS~1\Temp\mono_aot_D2ID2U.o 
Compiled 2 out of 2 methods (100%) Methods without GOT slots: 2 (100%) 
Direct calls: 0 (100%) JIT time: 0 ms, Generation time: 0 ms, 
Assembly+Link time: 319 ms. GOT slot distribution: 
image: 1 

mais qui produit un Main.exe.dll et je veux un exécutable. Est-ce possible?

Mise à jour:

J'intercepté le processus AOT/construction en écriture protégeant Main.exe.dll et maintenant j'ai un mono_aot_FZKP2U.o mais toujours pas de chance:

>gcc -o Main2.exe mono_aot_FZKP2U.o 
/mingw/lib/libmingw32.a(main.o):main.c:(.text+0x104): 
undefined reference to `[email protected]' 
collect2: ld returned 1 exit status` 

Mise à jour 2009-10-30: Après avoir lu Jb Evains réponse, j'ai encore une fois essayé de runt Main.exe avec mono sans succès.

 
C:\test>mono Main.exe.dll 
Mono-INFO: Assembly Loader probing location: 'C:\PROGRA~1\MONO-2~1.3\lib\mono\1. 
0\mscorlib.dll'. 
Mono-INFO: Image addref mscorlib 003E5F48 -> C:\PROGRA~1\MONO-2~1.3\lib\mono\1.0 
\mscorlib.dll 00B42BC0: 2 

Mono-INFO: AOT failed to load AOT module C:\PROGRA~1\MONO-2~1.3\lib\mono\1.0\msc 
orlib.dll.dll: The system cannot find the file specified. 


Mono-INFO: Assembly Loader loaded assembly from location: 'C:\PROGRA~1\MONO-2~1. 
3\lib\mono\1.0\mscorlib.dll'. 
Mono-INFO: Config attempting to parse: 'C:\PROGRA~1\MONO-2~1.3\lib\mono\1.0\msco 
rlib.dll.config'. 
Mono-INFO: Config attempting to parse: 'C:\PROGRA~1\MONO-2~1.3\lib\..\etc\mono\a 
ssemblies\mscorlib\mscorlib.config'. 
Mono-INFO: Assembly mscorlib 003E5F48 added to domain Main.exe.dll, ref_count=1 

Mono-INFO: Config attempting to parse: 'C:\PROGRA~1\MONO-2~1.3\lib\..\etc\mono\c 
onfig'. 
Mono-INFO: Assembly Loader probing location: 'Main.exe.dll'. 
Cannot open assembly 'Main.exe.dll': File does not contain a valid CIL image. 
Mono-INFO: Unloading domain Main.exe.dll 00B04EA0, assembly mscorlib 003E5F48, r 
efcount=1 

Mono-INFO: Unloading assembly mscorlib [003E5F48]. 
Mono-INFO: Unloading image C:\PROGRA~1\MONO-2~1.3\lib\mono\1.0\mscorlib.dll [00B 
42BC0]. 
+0

Votre problème réside dans l'appel de gcc, qui le compile explicitement à une bibliothèque ... c'est peut-être un comportement voulu? – Bobby

+0

Oui, mais le mono_aot_D2ID2U.o est supprimé dans le processus, donc je n'ai aucune chance de lancer moi-même gcc. –

+0

La documentation indique également que cela fonctionne sous * nix. http://mono-project.com/AOT –

Répondre

5

Le processus de compilation Mono AOT ne crée pas d'exécutable. Il crée en effet une bibliothèque. Mono récupère automatiquement le code AOTed si possible, il suffit d'exécuter mono Main.exe comme vous le feriez normalement. Vous pouvez vérifier en spécifiant la variable d'environnement MONO_LOG_LEVEL=debug si Mono récupère le code natif.

+0

Merci, ne connaissait pas le MONO_LOG_LEVEL. –

+0

Je ne peux pas non plus faire fonctionner la DLL. Voir ma mise à jour à la question. –

+0

Eh bien, vous ne pouvez pas «lancer» une DLL. Comme je l'ai dit, exécutez 'mono Main.exe', et mono chargera Main.exe.dll pour vous. –