il2cpp-pinvoke-support.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #pragma once
  2. typedef enum Il2CppCallConvention
  3. {
  4. IL2CPP_CALL_DEFAULT,
  5. IL2CPP_CALL_C,
  6. IL2CPP_CALL_STDCALL,
  7. IL2CPP_CALL_THISCALL,
  8. IL2CPP_CALL_FASTCALL,
  9. IL2CPP_CALL_VARARG
  10. } Il2CppCallConvention;
  11. typedef enum Il2CppCharSet
  12. {
  13. CHARSET_ANSI,
  14. CHARSET_UNICODE,
  15. CHARSET_NOT_SPECIFIED
  16. } Il2CppCharSet;
  17. #include "il2cpp-windowsruntime-types.h"
  18. typedef void (*PInvokeMarshalToNativeFunc)(void* managedStructure, void* marshaledStructure);
  19. typedef void (*PInvokeMarshalFromNativeFunc)(void* marshaledStructure, void* managedStructure);
  20. typedef void (*PInvokeMarshalCleanupFunc)(void* marshaledStructure);
  21. typedef struct Il2CppIUnknown* (*CreateCCWFunc)(Il2CppObject* obj);
  22. #if RUNTIME_MONO
  23. #include "il2cpp-mapping.h"
  24. #endif
  25. typedef struct Il2CppInteropData
  26. {
  27. Il2CppMethodPointer delegatePInvokeWrapperFunction;
  28. PInvokeMarshalToNativeFunc pinvokeMarshalToNativeFunction;
  29. PInvokeMarshalFromNativeFunc pinvokeMarshalFromNativeFunction;
  30. PInvokeMarshalCleanupFunc pinvokeMarshalCleanupFunction;
  31. CreateCCWFunc createCCWFunction;
  32. const Il2CppGuid* guid;
  33. #if RUNTIME_MONO
  34. MonoMetadataToken typeToken;
  35. uint64_t hash;
  36. #else
  37. const Il2CppType* type;
  38. #endif
  39. } Il2CppInteropData;
  40. #if defined(__cplusplus)
  41. #include "utils/StringView.h"
  42. struct PInvokeArguments
  43. {
  44. const il2cpp::utils::StringView<Il2CppNativeChar> moduleName;
  45. const il2cpp::utils::StringView<char> entryPoint;
  46. Il2CppCallConvention callingConvention;
  47. Il2CppCharSet charSet;
  48. int parameterSize;
  49. bool isNoMangle; // Says whether P/Invoke should append to function name 'A'/'W' according to charSet.
  50. };
  51. #endif