Open timothey-lemley-koerber opened 8 months ago
I had to add a path to the snap7 .dll as a constant string and use that everytime I called a function. I got the program to compile and run, but it's not connecting to my PLC yet.
const PATH_TO_LIB: &str = "C:/Users/xxx/Documents/tooling/c++/snap7-full-1.4.2/snap7-full-1.4.2/build/bin/win64/snap7.dll";
impl Client { pub fn new() -> Self { let lib = unsafe {LibSnap7::Cli_Create(&snap7_sys::LibSnap7::new(Path::new(PATH_TO_LIB)).unwrap())} ;
I was able to get the connection working by adding a reference to the library in the struct implementation:
```
let snap = unsafe { snap7_sys::LibSnap7::new(Path::new(PATH_TO_LIB)).unwrap() }; let lib = unsafe {LibSnap7::Cli_Create(&snap)} ; Self { snap: snap,
Hello, I am new to Rust, so this maybe a stupid problem, but when I try to build your example program I get the following error:
&snap7_sys::LibSnap7
is missing~~~~~~~~I do not know what to do here.