I imagine you'll have to call the Java System.out.println from C. I forget how exactly to do this.
Java streams and ANSI/POSIX C streams aren't compatible. The C ones usually rely on having an OS file descriptor, and Java allows making new kinds by implementing interfaces. There's not a general way (at least not a portable one) to get a file descriptor for a user space object. On Fri, Feb 14, 2020 at 5:40 AM Sonny To <son.c...@gmail.com> wrote: > here is an example of > > > > > >> package foo; >> >> >> >> import com.sun.jna.Library; >> >> >> import com.sun.jna.Native; >> >> >> import com.sun.jna.Pointer; >> >> >> >> >> >> public interface C extends Library { >> >> >> C INSTANCE = (C) Native.load("c",C.class); >> >> >> >> >> >> void printf(String format, Object... args); >> >> >> } >> >> > > > > calling this from a java main like this works as expected at the command > line > C.INSTANCE.printf("hello\n"); > > but from the clojure REPL, > > (.printf foo.C/INSTANCE "hello "(into-array [])) > > > does not show anything > > On Friday, February 14, 2020 at 6:30:51 PM UTC+8, Sonny To wrote: >> >> I am using JNA to call native C code. calling native code that outputs to >> stdout does not show up in the Clojure REPL. stdout is redirected somewhere >> that is not attached to *out* >> >> How can I get stdout from native code outputting to *out* in the REPL? >> Without this, it makes it difficult to see what went wrong in the C code. >> >> thanks, >> Sonny >> > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/clojure/bd950525-defd-4696-948e-ac321dc5220e%40googlegroups.com > <https://groups.google.com/d/msgid/clojure/bd950525-defd-4696-948e-ac321dc5220e%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/clojure/CAB6_SoZouGg9vWxwHK92QpSPnLW%2Bz4gROyGKm6mR9W5%3DF-_Hkg%40mail.gmail.com.