Quantcast
Channel: Questions in topic: "il2cpp"
Viewing all articles
Browse latest Browse all 598

How to enable '-fdeclspec' or '-fms-extensions' compiler options to compile C++ source code in project?

$
0
0
I'm trying to have C++ source code in my project compiled when I build it instead of having a library instead to avoid the performance costs of P/Invoke. Following the instructions here: https://docs.unity3d.com/2019.3/Documentation/Manual/macOSPlayerCPlusPlusSourceCodePluginsForIL2CPP.html I've got the C++ code in Assets/Plugins/Mac/x86_64/NativeFunctions.cpp and the import settings set to Standalone/Mac OS X x64. When I try to build and run I get this error (and warning): [ERROR] FATAL UNHANDLED EXCEPTION: Unity.IL2CPP.Building.BuilderFailedException: /Users/....../project/Temp/StagingArea/Data/il2cppOutput/NativeFunctions.cpp:1:15: error: '__declspec' attributes are not enabled; use '-fdeclspec' or '-fms-extensions' to enable support for __declspec attributes extern "C" __declspec(dllexport) int __stdcall CountLettersInString(wchar_t* str) ^ /Users/...../project/Temp/StagingArea/Data/il2cppOutput/NativeFunctions.cpp:1:41: warning: '__stdcall' calling convention is not supported for this target [-Wignored-attributes]extern "C" __declspec(dllexport) int __stdcall CountLettersInString(wchar_t* str) ^ 1 warning and 1 error generated. I'm using Unity 2020.1.8f1 on OS X 10.15.7. Is there anyway I'm able to customize the compiler's arguments? Specifically so I can add -fdeclspec to the clang++ invocation.

Viewing all articles
Browse latest Browse all 598

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>