Allocator.h 406 B

12345678910111213141516171819202122232425262728
  1. #pragma once
  2. #include <stddef.h>
  3. typedef void* (*allocate_func)(size_t size);
  4. #if defined(__cplusplus)
  5. extern "C"
  6. {
  7. #endif
  8. void register_allocator(allocate_func allocator);
  9. #if defined(__cplusplus)
  10. }
  11. #endif
  12. #if defined(__cplusplus)
  13. #include <string>
  14. class Allocator
  15. {
  16. public:
  17. static void* Allocate(size_t size);
  18. static char* CopyToAllocatedStringBuffer(const std::string& input);
  19. };
  20. #endif