il2cpp-pinvoke-support.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. typedef struct Il2CppInteropData
  23. {
  24. Il2CppMethodPointer delegatePInvokeWrapperFunction;
  25. PInvokeMarshalToNativeFunc pinvokeMarshalToNativeFunction;
  26. PInvokeMarshalFromNativeFunc pinvokeMarshalFromNativeFunction;
  27. PInvokeMarshalCleanupFunc pinvokeMarshalCleanupFunction;
  28. CreateCCWFunc createCCWFunction;
  29. const Il2CppGuid* guid;
  30. const Il2CppType* type;
  31. } Il2CppInteropData;
  32. #if defined(__cplusplus)
  33. #include "utils/StringView.h"
  34. struct PInvokeArguments
  35. {
  36. const il2cpp::utils::StringView<Il2CppNativeChar> moduleName;
  37. const il2cpp::utils::StringView<char> entryPoint;
  38. Il2CppCallConvention callingConvention;
  39. Il2CppCharSet charSet;
  40. int parameterSize;
  41. bool isNoMangle; // Says whether P/Invoke should append to function name 'A'/'W' according to charSet.
  42. };
  43. #endif