MichalStrehovsky / zerosharp

Demo of the potential of C# for systems programming with the .NET native ahead-of-time compilation technology.
2.02k stars 105 forks source link

Exporting and importing libraries with /SUBSYSTEM:EFI_APPLICATION is not supported #29

Closed nifanfa closed 2 years ago

nifanfa commented 2 years ago
Runtime.WorkstationGC.lib(thread.cpp.obj) : error LNK2005: RhpReversePInvoke is already defined in efinoruntime.obj [C:\Users\nifan\Documents\GitHub\zerosharp\efi-no-runtime\efinoruntime.csproj]
Runtime.WorkstationGC.lib(thread.cpp.obj) : error LNK2005: RhpReversePInvokeReturn is already defined in efinoruntime.obj [C:\Users\nifan\Documents\GitHub\zerosharp\efi-no-runtime\efinoruntime.csproj]
Runtime.WorkstationGC.lib(PInvoke.asm.obj) : error LNK2005: RhpPInvoke is already defined in efinoruntime.obj [C:\Users\nifan\Documents\GitHub\zerosharp\efi-no-runtime\efinoruntime.csproj]
Runtime.WorkstationGC.lib(PInvoke.asm.obj) : error LNK2005: RhpPInvokeReturn is already defined in efinoruntime.obj [C:\Users\nifan\Documents\GitHub\zerosharp\efi-no-runtime\efinoruntime.csproj]
Runtime.WorkstationGC.lib(EHHelpers.cpp.obj) : error LNK2005: RhpFallbackFailFast is already defined in efinoruntime.obj [C:\Users\nifan\Documents\GitHub\zerosharp\efi-no-runtime\efinoruntime.csproj]
LINK : fatal error LNK1294: Exporting and importing libraries with /SUBSYSTEM:EFI_APPLICATION is not supported [C:\Users\nifan\Documents\GitHub\zerosharp\efi-no-runtime\efinoruntime.csproj]
C:\Users\nifan\.nuget\packages\microsoft.dotnet.ilcompiler\7.0.0-alpha.1.22068.1\build\Microsoft.NETCore.Native.targets(376,5): error MSB3073: Command "link @ "obj\Debug\net6.0\win-x64\native\link.rsp"" exited with code 1294. [C:\Users\nifan\Documents\GitHub\zerosharp\efi-no-runtime\efinoruntime.csproj]
MichalStrehovsky commented 2 years ago

I'm not hitting this in the efinoruntime demo. Do you have any local changes?

nifanfa commented 2 years ago

no i'm just trying to add these code

object obj = new object();
MichalStrehovsky commented 2 years ago

That's expected. You need a garbage collector for that. Link.exe is trying to include the Windows one. That won't work.