mirror of
https://github.com/Sarsoo/csbindgen.git
synced 2025-01-09 13:27:47 +00:00
Merge remote-tracking branch 'origin/main' into fix-pointer-pointer
This commit is contained in:
commit
e1b69be5b7
@ -79,7 +79,9 @@ cc::Build::new().file("lz4.c").compile("lz4");
|
|||||||
|
|
||||||
// csbindgen code, generate both rust ffi and C# dll import
|
// csbindgen code, generate both rust ffi and C# dll import
|
||||||
csbindgen::Builder::default()
|
csbindgen::Builder::default()
|
||||||
.input_bindgen_file("lz4.rs") // read from bindgen generated code
|
.input_bindgen_file("lz4.rs") // read from bindgen generated code
|
||||||
|
.rust_file_header("use super::lz4::*;") // import bindgen generated modules(struct/method)
|
||||||
|
.csharp_entry_point_prefix("csbindgen_") // adjust same signature of rust method and C# EntryPoint
|
||||||
.csharp_dll_name("liblz4")
|
.csharp_dll_name("liblz4")
|
||||||
.generate_to_file("lz4_ffi.rs", "../dotnet/NativeMethods.lz4.g.cs")
|
.generate_to_file("lz4_ffi.rs", "../dotnet/NativeMethods.lz4.g.cs")
|
||||||
.unwrap();
|
.unwrap();
|
||||||
@ -93,12 +95,12 @@ It will generates like these code.
|
|||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
use ::std::os::raw::*;
|
use ::std::os::raw::*;
|
||||||
|
|
||||||
use super::lz4;
|
use super::lz4::*;
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn csbindgen_LZ4_compress_default(src: *const c_char, dst: *mut c_char, srcSize: c_int, dstCapacity: c_int) -> c_int
|
pub unsafe extern "C" fn csbindgen_LZ4_compress_default(src: *const c_char, dst: *mut c_char, srcSize: c_int, dstCapacity: c_int) -> c_int
|
||||||
{
|
{
|
||||||
lz4::LZ4_compress_default(src, dst, srcSize, dstCapacity)
|
LZ4_compress_default(src, dst, srcSize, dstCapacity)
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user