-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] Access violation on Windows builds #165
Comments
I've discovered that if I replace |
@junglie85, thank you for the report! Reproduced the issue in https://github.com/eclipse-zenoh/zenoh-c/tree/pub_crash_on_windows branch (z_crash example), investigating |
Problem doesn't happen if examples are built with static zenoh library:
But for dynamic library case the problem exists:
dynamic linking:
Seems like the way how it is exported from rust is incorrect: #[no_mangle]
pub static Z_CONFIG_CONNECT_KEY: &c_char =
unsafe { &*(b"connect/endpoints\0".as_ptr() as *const c_char) }; |
Problem occurs on all constants, not only on string ones. This code: printf("Z_ROUTER = %d\n", Z_ROUTER);
printf("Z_PEER = %d\n", Z_PEER);
printf("Z_CLIENT = %d\n", Z_CLIENT); also outputs wrong values:
The working solution is to add __declspec(dllimport) extern const unsigned int Z_ROUTER;
__declspec(dllimport) extern const unsigned int Z_PEER;
extern const unsigned int Z_CLIENT; the output is
Here are some information which may help: It may be also make sense to consider |
Describe the bug
Running a simple publisher on Windows fails with an access violation accessing location 0xFF whereas the exact same program on WSL (Ubuntu) runs as expected.
To reproduce
Start a subscriber:
In WSL, build the
zenoh-c
library as per the repo instructions then compile the following program:Build and run:
See output and message in subscriber:
Repeat, but in Windows:
System info
The text was updated successfully, but these errors were encountered: