redsift / rkdb

kdb+ Rust embedding and IPC
MIT License
17 stars 6 forks source link

cannot pass symbols from kdb to rust function #15

Open ajayrathore opened 4 years ago

ajayrathore commented 4 years ago

Looks like cannot pass list of symbols from kdb to rust function

#[no_mangle]
pub extern "C" fn ksymbols(k: *const K) -> *const K {
    match KVal::new(k) {
        KVal::Symbol(KData::List(s)) => println!("Symbols received {:?}", s),
        _ => println!("no symbols"),
    }
    kvoid()
}

q)ksymbols[`a`b`c`d]
thread '<unnamed>' panicked at 'byte index 80 is not a char boundary; it is inside '\u{0}' (bytes 79..80) of `aC[��������lj��
��������ljfN�Z�5`����������aj>gGf��p����������.Q.fl�eGf��������.Q.ff�^���������.Q.ajf0����������g����������`[...]', src/libcore/str/mod.rs:2154:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5
q: warning: q crashed, killed by SIGABRT.
q itself has not crashed, but for transparency,
it will now kill itself (without dumping core) with the same signal