Xcode 如何防止在Unity3d IL2CPP中剥离托管DLL
我正在使用Xcode 如何防止在Unity3d IL2CPP中剥离托管DLL,xcode,encoding,unity3d,mono,il2cpp,Xcode,Encoding,Unity3d,Mono,Il2cpp,我正在使用System.Text.Encoding的1252编码扩展ASCII支持,以充分利用字节的第8位,到目前为止,当使用Mono作为脚本后端时,我将能够防止通过资产/link.xml文件剥离代码,如下所示: <assembly fullname="I18N"> <type fullname="I18N.Common" preserve="all"/> <type fullname="I18N.Common.ByteEncoding" prese
System.Text.Encoding
的1252编码扩展ASCII支持,以充分利用字节的第8位,到目前为止,当使用Mono作为脚本后端时,我将能够防止通过资产/link.xml
文件剥离代码,如下所示:
<assembly fullname="I18N">
<type fullname="I18N.Common" preserve="all"/>
<type fullname="I18N.Common.ByteEncoding" preserve="all"/>
<type fullname="I18N.Common.Handlers" preserve="all"/>
<type fullname="I18N.Common.Manager" preserve="all"/>
<type fullname="I18N.Common.MonoEncoder" preserve="all"/>
<type fullname="I18N.Common.MonoEncoding" preserve="all"/>
<type fullname="I18N.Common.Strings" preserve="all"/>
</assembly>
<assembly fullname="I18N.West">
<type fullname="I18N.West" preserve="all"/>
<type fullname="I18N.West.ENCwindows_1252" preserve="all"/>
<type fullname="I18N.West.CP1252" preserve="all"/>
</assembly>
这与在Mono中相同,当我删除link.xml中的preserve
语句时:
NotSupportedException: CodePage 1252 not supported
at System.Text.Encoding.GetEncoding (Int32 codepage) [0x00000] in <filename unknown>:0
提前非常感谢 实际上,您可能在IL2CPP运行时中看到了一个与代码剥离无关的bug。使用Unity的4.6.4p3版本,我可以看到同样的问题,并且我已经找到了它。我们应该能够在下一个补丁版本中修复这个问题
事实证明,libil2cpp运行时中的icall与mscorlib中的托管代码交互不正确,因此mscorlib中的代码被发送到IL2CPP脚本后端的另一条路径
NotSupportedException: CodePage 1252 not supported
at System.Text.Encoding.GetEncoding (Int32 codepage) [0x00000] in <filename unknown>:0
byte[] bytes = System.Text.Encoding.GetEncoding(1252).GetBytes(str); // exactly 8-bit
string str = System.Text.Encoding.GetEncoding(1252).GetString(bytes);