No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

MarshalingUtils.cpp 1.2KB

123456789101112131415161718192021222324252627282930313233343536
  1. #include "MarshalingUtils.h"
  2. #include "il2cpp-pinvoke-support.h"
  3. namespace il2cpp
  4. {
  5. namespace utils
  6. {
  7. void MarshalingUtils::MarshalStructToNative(void* managedStructure, void* marshaledStructure, const Il2CppInteropData* interopData)
  8. {
  9. IL2CPP_ASSERT(interopData);
  10. IL2CPP_ASSERT(interopData->pinvokeMarshalToNativeFunction);
  11. interopData->pinvokeMarshalToNativeFunction(managedStructure, marshaledStructure);
  12. }
  13. void MarshalingUtils::MarshalStructFromNative(void* marshaledStructure, void* managedStructure, const Il2CppInteropData* interopData)
  14. {
  15. IL2CPP_ASSERT(interopData);
  16. IL2CPP_ASSERT(interopData->pinvokeMarshalFromNativeFunction);
  17. interopData->pinvokeMarshalFromNativeFunction(marshaledStructure, managedStructure);
  18. }
  19. bool MarshalingUtils::MarshalFreeStruct(void* marshaledStructure, const Il2CppInteropData* interopData)
  20. {
  21. if (interopData == NULL)
  22. return false;
  23. PInvokeMarshalCleanupFunc cleanup = interopData->pinvokeMarshalCleanupFunction;
  24. if (cleanup == NULL)
  25. return false;
  26. cleanup(marshaledStructure);
  27. return true;
  28. }
  29. } // namespace utils
  30. } // namespace il2cpp