Describe the bug
We were recently porting some code from Linux to Windows and ran into a difficult issue.
Some of the Windows system headers transitively include objbase.h, which contains the line
If Zenoh is included after these, compilation may fail due to lines such as the following:
|
static void drop(void* context) { |
|
auto interface = static_cast<ShmProviderAsyncInterface*>(context); |
|
delete interface; |
|
} |
|
|
|
static void result(void* context, struct z_buf_layout_alloc_result_t* result) { |
|
auto interface = static_cast<ShmProviderAsyncInterface*>(context); |
|
interface->on_result(Converters::from(*result)); |
|
} |
In this case interface is interpreted as struct and the line cannot be parsed correctly.
Our solution was to undefine and redefine interface before and after the inclusion of Zenoh, however a minor change to the name of the variables in these and similar cases would remove the issue for future users and save some difficult troubleshooting.
To reproduce
- Be on Windows
- Include
oojbase.h before zenoh.hxx
System info
Describe the bug
We were recently porting some code from Linux to Windows and ran into a difficult issue.
Some of the Windows system headers transitively include
objbase.h, which contains the lineIf Zenoh is included after these, compilation may fail due to lines such as the following:
zenoh-cpp/include/zenoh/api/shm/provider/shm_provider.hxx
Lines 36 to 44 in 4038337
In this case
interfaceis interpreted asstructand the line cannot be parsed correctly.Our solution was to undefine and redefine
interfacebefore and after the inclusion of Zenoh, however a minor change to the name of the variables in these and similar cases would remove the issue for future users and save some difficult troubleshooting.To reproduce
oojbase.hbeforezenoh.hxxSystem info