These are chat archives for rust-lang/rust

30th
Oct 2017
Moggers
@Moggers
Oct 30 2017 07:51
how does RLS actually work
is it on a file by file basis
or does it work at a crate level?
I'm experimenting with the LanguageServer plugin for vim, with rls
but my quickfix only shows issues in the current file
Moggers
@Moggers
Oct 30 2017 15:30
is there anything remotely close to like, "rust in rust"
Steve Klabnik
@steveklabnik
Oct 30 2017 15:30
what does that mean
John-John Tedro
@udoprog
Oct 30 2017 15:32
I think the last statement might be asking if the compiler is modular so that it can be embedded in another rust application (RLS, in this case)?
Moggers
@Moggers
Oct 30 2017 15:32
its more
some way to provide some rust code to run on top of a rust application, with some functionality exposed to it?
Steve Klabnik
@steveklabnik
Oct 30 2017 15:34
ah
Moggers
@Moggers
Oct 30 2017 15:34
idk what this kind of stuff is usually called
Steve Klabnik
@steveklabnik
Oct 30 2017 15:34
not really, however there are other ways to write code that executes at runtime
dyon, gluon, etc
heck you can eeven embed ruby/python/lua if you really want to (the last one being the best candidate honestly)
Moggers
@Moggers
Oct 30 2017 15:35
yeah that's the kind of thing I was going for
I'm going to look into dyon, this sounds like it could do what I want
thanks ^^
Steve Klabnik
@steveklabnik
Oct 30 2017 15:38
:D
Russ
@rustysec
Oct 30 2017 16:43
coincidentally Rhai is also in development.
Zhiting Zhu
@photoszzt
Oct 30 2017 20:55
how to link a dynamic linking c library when compiling test cases? The lib that I want to test depends on a *-sys crate which generates binding for a dynamic linking library. So when compiling the test cases, I have to link the c library. Passing links seems only work for static linking library.
I want a solution that works for cargo
Jonas Platte
@jplatte
Oct 30 2017 20:59
@photoszzt It should just work out of the box. Are you getting linker errors?
Zhiting Zhu
@photoszzt
Oct 30 2017 20:59
@jplatte yes.
Jonas Platte
@jplatte
Oct 30 2017 20:59
Which -sys crate is this?
Zhiting Zhu
@photoszzt
Oct 30 2017 21:00
bcc-sys
That library generates binding for libbcc.so
Jonas Platte
@jplatte
Oct 30 2017 21:00
Oh, you created that yourself?
Zhiting Zhu
@photoszzt
Oct 30 2017 21:00
yes
I have a project that depends on that crate.
I try to add links at the bcc-sys Cargo.toml but it still doesn't work.
Jonas Platte
@jplatte
Oct 30 2017 21:02
You need to use the #[link(libraryname)] attribute: https://doc.rust-lang.org/book/first-edition/ffi.html#calling-foreign-functions
(in your -sys crate)
Also, you seem to have created one extern "C" block for every function
You only need one
Zhiting Zhu
@photoszzt
Oct 30 2017 21:03
Ah, those are generated by bindgen
Jonas Platte
@jplatte
Oct 30 2017 21:04
Oh, okay
I've never used bindgen before
You should look through the bindgen documentation then