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

error LNK2001: unresolved external symbol __security_cookie #45

Closed zhongzf closed 1 year ago

zhongzf commented 1 year ago

I changed TargetFramework to net7.0 and used 'PublishAot', I can compile helloworld, but if there is 'stackalloc' in the C# code, it will throw the above error while compiling. Anything else I should in the code or project file?

zhongzf commented 1 year ago

it seems it's because of '/GS (Buffer Security Check)', if there any option I can disable it? https://learn.microsoft.com/en-us/cpp/build/reference/gs-buffer-security-check?view=msvc-170

zhongzf commented 1 year ago

Problem solved. Add a dummy method security_cookie ` [RuntimeExport("__security_cookie")] static void security_cookie() { }`