microsoft / vcrt-forwarders

App-local DLLs that forward to Visual C++ runtime components
MIT License
32 stars 17 forks source link

VCRT Forwarders Initializer breaks iOS/Mac builds #23

Open chrisfromwork opened 4 years ago

chrisfromwork commented 4 years ago

The call here fails for me in a Mac Unity Editor (2019.2.*): https://github.com/microsoft/vcrt-forwarders/blob/d82a8fd2ba9c1311258939e731e848d1684a1a80/Unity/Editor/InitVCRTForwarders.cs#L27

It seems that these initializer c# scripts should only run in UNITY_EDITOR_WIN environments. Wrapping the InitVCRTForwarders.cs file content in UNITY_EDITOR_WIN ifdefs unblocked iOS builds for me. Note: this affects all other projects that follow this model of calling LoadLibraryExW in the Unity editor, such as Microsoft.MixedReality.QR

When this error occurs, it may not necessarily result in a formal Unity build failure. In my case, it does prevent other prebuild/postbuild scripts from running. This causes things like Azure Spatial Anchors that copies Podfiles into generate iOS project folders to fail, causing the iOS build to fail in xcode.

chrisfromwork commented 4 years ago

@dfields-msft

dfields-msft commented 4 years ago

@majaeger can we use the .meta file to disable this script for non-Windows configurations?

majaeger commented 4 years ago

@dfields-msft , I don't believe we can do this in the .meta files for the editor host platform. I believe we'll need to update the code files as @chrisfromwork stated to use the UNITY_EDITOR_WIN define instead of the broader UNITY_EDITOR