How to compile
C/C++
C++ is a high-level programming language developed by Bjarne Stroustrup at Bell Labs. C++ adds object-oriented features to its predecessor, C. C++ is one of the most popular programming language for graphical applications, such as those that run in Windows and Macintosh environments.
const int* hash; // ascii representation
int main() { }
char* hash_addr() { return &hash[0]; }
int hash_len() { return hash.length(); }
RUST
Rust is a multi-paradigm system programming language focused on safety, especially safe concurrency. Rust is syntactically similar to C++, but is designed to provide better memory safety while maintaining high performance.
use std::ffi::CString;
use std::os::raw::c_char;
static HELLO: &'static str = "Yes, it Qan";
#[no_mangle]
pub fn get_hello() -> *mut c_char {
let s = CString::new(HELLO).unwrap();
s.into_raw()
}
#[no_mangle]
pub fn get_hello_len(i: i32) -> i32 {
HELLO.len() as i32
}
Typescript
TypeScript is an open-source programming language developed and maintained by Microsoft. It is a strict syntactical superset of JavaScript, and adds optional static typing to the language. TypeScript is designed for development of large applications and transcompiles to JavaScript.
const hash: Uint8Array = ... ;
export function main(): i32 { }
export function hash_addr(): Uint8Array { return hash }
export function hash_len(): i32 { return hash.length() }
Last updated
Was this helpful?