need help to use C++ callback from garnet
Dakota
dakota at gmail.com
Wed May 29 07:47:01 UTC 2024
I try use
https://github.com/microsoft/garnet/blob/main/libs/storage/Tsavorite/cc/src/device/native_device_wrapper.cc from D
Not sure how to make this work with D:
```c++
EXPORTED_SYMBOL FASTER::core::Status
NativeDevice_ReadAsync(NativeDevice* device, uint64_t source,
void* dest, uint32_t length, FASTER::core::AsyncIOCallback
callback, void* context) {
return device->ReadAsync(source, dest, length, callback,
context);
}
EXPORTED_SYMBOL FASTER::core::Status
NativeDevice_WriteAsync(NativeDevice* device, const void* source,
uint64_t dest, uint32_t length, FASTER::core::AsyncIOCallback
callback, void* context) {
return device->WriteAsync(source, dest, length, callback,
context);
}
```
I need to define `FASTER::core::AsyncIOCallback callback` from D,
any way to workaround ? (like modify garnet source code to
support pass a C function callback)
I am newbie to C++ and D, any help will be appreciate
More information about the Digitalmars-d-learn
mailing list