add win support
This commit is contained in:
parent
d9b2a372f1
commit
d42bdb758c
|
@ -1,6 +1,6 @@
|
|||
mod dqn;
|
||||
mod ffi;
|
||||
use std::{ffi::OsStr, os::unix::ffi::OsStrExt};
|
||||
use std::ffi::OsString;
|
||||
|
||||
use burn::backend::{wgpu::AutoGraphicsApi, Wgpu};
|
||||
use dqn::prelude::*;
|
||||
|
@ -12,11 +12,9 @@ type Backend = Wgpu<AutoGraphicsApi, f32, i32>;
|
|||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn init(model_path: *const u8, len: i32) -> *mut DQNApp<'static> {
|
||||
let model_path =
|
||||
OsStr::from_bytes(unsafe { std::slice::from_raw_parts(model_path, len as usize) })
|
||||
.to_str()
|
||||
.unwrap();
|
||||
let app = DQNApp::new(model_path);
|
||||
let model_path = unsafe { std::slice::from_raw_parts(model_path, len as usize) };
|
||||
let model_path = unsafe { OsString::from_encoded_bytes_unchecked(model_path.to_vec()) };
|
||||
let app = DQNApp::new(model_path.to_str().unwrap());
|
||||
|
||||
Box::into_raw(Box::new(app))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue