Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.13-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-bin.zip
11 changes: 5 additions & 6 deletions src/os/unix/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use os::unix::external;
use os::unix::OkOrDlerror;
use os::unix::RTLD_LAZY;
use util;
use std::ffi::CString;
use std::mem;
use std::path::Path;
use std::os::raw::c_char;
Expand All @@ -16,15 +17,13 @@ pub struct Lib {
impl Lib {
pub unsafe fn new<TPath>(path_to_lib: TPath) -> Result<Lib>
where TPath: AsRef<Path> {
let path_to_lib_str =
path_to_lib
.as_ref()
.to_string_lossy();
let path_to_lib_c_str = path_to_lib_str.as_ptr() as *const c_char;
let path_to_lib_c_str = CString::new(path_to_lib.as_ref().to_string_lossy().as_ref())
.chain_err( || ErrorKind::LibraryOpen(path_to_lib.as_ref().to_path_buf()))?;
let path_to_lib_c_ptr = path_to_lib_c_str.as_ptr();

util::error_guard(
|| {
let result = external::dlopen(path_to_lib_c_str, RTLD_LAZY);
let result = external::dlopen(path_to_lib_c_ptr, RTLD_LAZY);

if result.is_null() {
None
Expand Down
2 changes: 1 addition & 1 deletion test/examplelib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ rsFiles.include "**/*.rs"

task cargoBuild(type: Exec) {
commandLine "cargo", "build"
inputs.file(rsFiles)
inputs.files(rsFiles)
outputs.file("target/debug/examplelib.dll")
}

Expand Down