This repository has been archived on 2024-05-26. You can view files and clone it, but cannot push or open issues or pull requests.
trixy/tests/multiple/expected.md

66 lines
1.3 KiB
Markdown
Raw Permalink Normal View History

# Host files
2024-03-26 16:28:21 +00:00
File path: `out/dir/api.rs`
2024-03-26 16:28:21 +00:00
```rust
// Host code
/* Rust API */
#[derive(Debug)]
pub enum Commands {
NameOne(name_one::NameOne),
}
pub mod name_one {
#[derive(Debug)]
pub enum NameOne {
#[allow(non_camel_case_types)]
from_first_namespace,
#[allow(non_camel_case_types)]
from_second_namespace,
}
}
/* C API */
pub mod name_one_c {}
#[no_mangle]
pub extern "C" fn name_one_from_first_namespace() -> core::ffi::c_int {
callback_function(name_one_from_first_namespace);
return 1;
}
#[no_mangle]
pub extern "C" fn name_one_from_second_namespace() -> core::ffi::c_int {
callback_function(name_one_from_second_namespace);
return 1;
}
// vim: filetype=rust
```
# Auxiliary files
2024-03-26 16:28:21 +00:00
File path: `dist/interface.h`
2024-03-26 16:28:21 +00:00
```c
#if !defined TRIXY_MAIN_HEADER
#define TRIXY_MAIN_HEADER
#include "errno.h"
#include "string.h"
#include "vec.h"
extern int name_one_from_first_namespace ();
extern int name_one_from_second_namespace ();
struct name_one
{
int (*from_first_namespace) (void);
int (*from_second_namespace) (void);
};
const struct name_one name_one = {
.from_first_namespace = name_one_from_first_namespace,
.from_second_namespace = name_one_from_second_namespace,
};
#endif // if !defined TRIXY_MAIN_HEADER
// vim: filetype=c
```