'C++ / Swift callback in Metal Framework method newBufferWithBytesNoCopy
I want to call the method newBufferWithBytesNoCopy from C++. This method is part of Apples Metal framework and is defined as this:
_MTL_INLINE MTL::Buffer* MTL::Device::newBuffer(const void* pointer,
NS::UInteger length,
MTL::ResourceOptions options,
const void (^deallocator)(void*, NS::UInteger))
The last parameter deallocator defines a callback, which gets called when the buffer gets destroyed. I tried to use a function pointer, but my compiler complains:
no known conversion from 'void (void *, NS::UInteger)' (aka 'void (void *, unsigned long)') to 'const void (^)(void *, NS::UInteger)' for 4th argument
_MTL_INLINE MTL::Buffer* MTL::Device::newBuffer(const void* pointer, NS::UInteger length, MTL::ResourceOptions options, const void (^deallocator)(void*, NS::UInteger))
Does anyone can show me how to provide a callback to this method?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
