blob: 2b8e51602e0f6cb4b4aec7140faf66899cadd6a0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
// Copyright 2018 Ryan Dahl <ry@tinyclouds.org>
// All rights reserved. MIT License.
extern crate libc;
use libc::c_char;
use std::ffi::CStr;
fn string_from_ptr(ptr: *const c_char) -> String {
let cstr = unsafe { CStr::from_ptr(ptr as *const i8) };
String::from(cstr.to_str().unwrap())
}
#[test]
fn test_example() {
assert_eq!(2 + 2, 4);
}
#[no_mangle]
pub extern "C" fn handle_code_fetch(
cmd_id: u32,
module_specifier: *const c_char,
containing_file: *const c_char,
) {
let module_specifier = string_from_ptr(module_specifier);
let containing_file = string_from_ptr(containing_file);
println!(
"handle_code_fetch. cmd_id = {} module_specifier = {} containing_file = {}",
cmd_id,
module_specifier,
containing_file
);
unimplemented!();
}
|