mirror of
https://github.com/Sarsoo/csbindgen.git
synced 2024-12-22 22:46:26 +00:00
lll
This commit is contained in:
parent
32af3f29e0
commit
a03eb06808
5
csbindgen-tests/build.rs
vendored
5
csbindgen-tests/build.rs
vendored
@ -129,9 +129,10 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
csbindgen::Builder::new()
|
||||
.input_bindgen_file("src/physx/physx_generated.rs")
|
||||
.input_bindgen_file("src/physx/x86_64-pc-windows-msvc/structgen.rs")
|
||||
// .csharp_disable_emit_dll_name(true)
|
||||
.csharp_namespace("Physx")
|
||||
.csharp_class_name("LibPhysxd")
|
||||
.csharp_dll_name("libphysx")
|
||||
.csharp_class_name("LibPhysx")
|
||||
.csharp_dll_name("libphys")
|
||||
.generate_csharp_file("../dotnet-sandbox/libphysx_csbindgen.cs")?;
|
||||
|
||||
Ok(())
|
||||
|
@ -22,6 +22,7 @@ pub struct BindgenOptions {
|
||||
pub csharp_namespace: String,
|
||||
pub csharp_class_name: String,
|
||||
pub csharp_dll_name: String,
|
||||
pub csharp_disable_emit_dll_name: bool,
|
||||
pub csharp_class_accessibility: String,
|
||||
pub csharp_entry_point_prefix: String,
|
||||
pub csharp_method_prefix: String,
|
||||
@ -43,6 +44,7 @@ impl Default for Builder {
|
||||
csharp_namespace: "CsBindgen".to_string(),
|
||||
csharp_class_name: "NativeMethods".to_string(),
|
||||
csharp_dll_name: "".to_string(),
|
||||
csharp_disable_emit_dll_name: false,
|
||||
csharp_entry_point_prefix: "".to_string(),
|
||||
csharp_method_prefix: "".to_string(),
|
||||
csharp_class_accessibility: "internal".to_string(),
|
||||
@ -121,6 +123,12 @@ impl Builder {
|
||||
self
|
||||
}
|
||||
|
||||
/// configure don't emit __DllName
|
||||
pub fn csharp_disable_emit_dll_name(mut self, csharp_disable_emit_dll_name: bool) -> Builder {
|
||||
self.options.csharp_disable_emit_dll_name = csharp_disable_emit_dll_name;
|
||||
self
|
||||
}
|
||||
|
||||
/// configure C# DllImport EntryPoint prefix,
|
||||
/// `[DllImport(, EntryPoint ="{csharp_entry_point_prefix}foo")]`
|
||||
pub fn csharp_entry_point_prefix<T: Into<String>>(
|
||||
|
@ -87,7 +87,7 @@ pub fn emit_csharp(
|
||||
let method_prefix = &options.csharp_method_prefix;
|
||||
let accessibility = &options.csharp_class_accessibility;
|
||||
|
||||
let dll_name = match options.csharp_if_symbol.as_str() {
|
||||
let mut dll_name = match options.csharp_if_symbol.as_str() {
|
||||
"" => format!(
|
||||
" const string __DllName = \"{}\";",
|
||||
options.csharp_dll_name
|
||||
@ -104,6 +104,9 @@ pub fn emit_csharp(
|
||||
)
|
||||
}
|
||||
};
|
||||
if options.csharp_disable_emit_dll_name {
|
||||
dll_name = "".to_string();
|
||||
}
|
||||
|
||||
let mut method_list_string = String::new();
|
||||
for item in methods {
|
||||
|
2
dotnet-sandbox/BindingGroupExtensions.cs
vendored
2
dotnet-sandbox/BindingGroupExtensions.cs
vendored
@ -3,7 +3,7 @@
|
||||
namespace Physx
|
||||
{
|
||||
[GroupedNativeMethodsGenerator.GroupedNativeMethods(removePrefix: "Px")]
|
||||
internal static unsafe partial class LibPhysxd
|
||||
internal static unsafe partial class LibPhysx
|
||||
{
|
||||
}
|
||||
}
|
||||
|
4
dotnet-sandbox/libphysx_csbindgen.cs
vendored
4
dotnet-sandbox/libphysx_csbindgen.cs
vendored
@ -9,9 +9,9 @@ using System.Runtime.InteropServices;
|
||||
|
||||
namespace Physx
|
||||
{
|
||||
internal static unsafe partial class LibPhysxd
|
||||
internal static unsafe partial class LibPhysx
|
||||
{
|
||||
const string __DllName = "libphysx";
|
||||
const string __DllName = "libphys";
|
||||
|
||||
[DllImport(__DllName, EntryPoint = "PxAllocatorCallback_delete", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
public static extern void PxAllocatorCallback_delete(PxAllocatorCallback* self_);
|
||||
|
Loading…
Reference in New Issue
Block a user