Hi Ty,

I just tried this out, and it looks like you need to say
"target/release/libembed" -- note the added "lib". Once I added that, your
program worked fine and printed everything out.

I wonder if the problem you're seeing is that DrRacket is sending the Rust
output somewhere else. Can you try running the program with just `racket
myprogram.rkt`?

Sam

On Tue, Nov 10, 2015 at 12:10 AM Ty Coghlan <coghlan...@gmail.com> wrote:

> I'm currently attempting to embed Rust into racket, following along with
> the tutorial at
> https://doc.rust-lang.org/stable/book/rust-inside-other-languages.html.
> For the most part I can get it to work when using functional programming in
> rust. I can call functions that return numbers/chars, however, I'm
> struggling to get side effects to work. For instance, when defining the
> "processs" function defined in the tutorial, I can not get the
> println!("Done!") (or the other print calls) to work in racket. I tried
> this both in drracket and with raco. The ffi call I used to attempt this is:
>
>     #lang racket/base
>     (require ffi/unsafe
>              ffi/unsafe/define)
>
>     (define rust-lib (ffi-lib "target/release/embed"))
>     (define process (get-ffi-obj "process" rust-lib (_fun -> _int)))
>     (process)
>
> Am I doing this correctly? Is this an issue I should take over to Rust's
> community, or are there certain steps I need to take in order for println
> to work?
>
> Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to