Skip to content

Commit

Permalink
Changes for dynamic linking.
Browse files Browse the repository at this point in the history
  • Loading branch information
kenba committed Nov 26, 2024
1 parent 39fc2cd commit be011a2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ edition = "2021"

[features]

static = ["cl3/static"]
dynamic = ["cl3/dynamic"]

# CL_VERSION_1_0 = ["cl3/CL_VERSION_1_0"]
CL_VERSION_1_1 = ["cl3/CL_VERSION_1_1"]
CL_VERSION_1_2 = ["cl3/CL_VERSION_1_2"]
CL_VERSION_2_0 = ["cl3/CL_VERSION_2_0"]
Expand Down Expand Up @@ -65,11 +69,13 @@ cl_pocl_content_size = ["cl3/cl_pocl_content_size"]
cl_loader_layers = ["cl3/cl_loader_layers"]

# Default features:
default = ["CL_VERSION_1_1", "CL_VERSION_1_2", "CL_VERSION_2_0"]
default = ["static", "CL_VERSION_1_1", "CL_VERSION_1_2", "CL_VERSION_2_0"]
# default = ["dynamic"]

[dependencies]
libc = "0.2"
cl3 = "0.10"
# cl3 = "0.10"
cl3 = { git = "https://github.com/kenba/cl3", branch = "develop" }
serde = { version = "1.0", optional = true }

[dev-dependencies]
Expand Down
4 changes: 2 additions & 2 deletions src/svm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ impl<'a, T> SvmRawVec<'a, T> {
alloc::dealloc(self.ptr.cast::<u8>(), layout);
}
} else {
unsafe { svm_free(self.context.get(), self.ptr.cast::<c_void>()) };
unsafe { let _ = svm_free(self.context.get(), self.ptr.cast::<c_void>()); };
}
}

Expand All @@ -175,7 +175,7 @@ impl<'a, T> Drop for SvmRawVec<'a, T> {
alloc::dealloc(self.ptr.cast::<u8>(), layout);
}
} else {
unsafe { svm_free(self.context.get(), self.ptr.cast::<c_void>()) };
unsafe { let _ = svm_free(self.context.get(), self.ptr.cast::<c_void>()); };
}
self.ptr = ptr::null_mut();
}
Expand Down

0 comments on commit be011a2

Please sign in to comment.