-
-
Notifications
You must be signed in to change notification settings - Fork 423
Closed
Description
#699 asked whether can we provide Any CPU DLLs, later I created a PR(#714 ) that provided basic implementation. But, during the impl process, I have found some questions. I need some feedback.
- For now, I decide to limit Any CPU DLLs will only built by new standalone project(that is, Steamworks.NET.Standard), and introduces a new platform macro. This is because, our major consumer, Unity is using a Mono based CLR. I'm not sure how expensive the Any CPU wrappers are on it. I believe CoreCLR and corresponding one on .NET Framework, can properly eliminate unused wrapping branch for other platforms, then inline whole Any CPU wrapper. If Unity can also optimize them properly, add this macro for performance reason should not be valid.
- It is sure that Turn standalone version targeting to Any CPU #714 is too large for review, should be split into smaller pieces, and merge them into a draft branch. These code changes of Any CPU is involves code generator, generated code and some hand written code. Through most hand written files only added a macro, but I remember there are some other changes. For next, here is my split plan:
- Split original P/Invoke holder class header
CodeGen/src/templates/nativemethods.txtinto 2 file. First is header, contains original platform detect, class declaration and P/Invoke names. Second filenativemethods_dllimport.txtis P/Invoke definition of free function. By split this file into 2 parts, platform agnostic P/Invoke generation can reuse the definition later. - Add P/Invoke holder class header for win64 and other platforms. File named
nativemethods_win64.txtandnativemethods_general.txt - Add forwarder header to
nativemethods_anycpu.txt. Any CPU is implemented by replacing original imported steam functions inNativeMethodswith forwarder. In forwarder, it will first detect what platform we are running on, then forward arguments to corresponding underlying version(win64 or other). - Add essential variables in
CodeGen/src/interfaces.py, they will be used in next step. Also, generated file creation is advanced to here. - Add forwarder class generation to generator, this is a big change. In current implementation, to make generator runnable, this change will approximately be 40 lines.
- Handle const usage of
Packsize.value, since Any CPU can't rely const field to indicate packsize, Currently, I use macroSTEAMWORKS_STANDALONE_ANYCPU, to remove mostPack = Packsize.valuein[StructLayout]of Any CPU usage. Pack size sentinel test still good. - Do some finalization.
- Split original P/Invoke holder class header
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels