While exploring
http://nakkaya.com/2009/11/16/java-native-access-from-clojure/

-------------------------------------------------------------------
(import 'com.sun.jna.Function)
(defmacro jna-call [lib func ret & args]
  `(let [library#  (name ~lib)
         function# (com.sun.jna.Function/getFunction library# ~func)]
     (.invoke function# ~ret (to-array [~@args]))))

(jna-call :user32 "MessageBoxA" Integer 0 "Hello" "Hello" 0)
-------------------------------------------------------------------

This should work... and it does.... from Incanter (!) directory only
if this command is used to launch the repl: "lein repl"

By work I mean it pops up a Hello dialog window.

Anywhere else:
1. from emacs via: lein swank
2. from simplest cmd line: java -cp clojure-1.2.0.jar;jna.jar
clojure.main
3. brand new lein new test1 -> lein repl

It does not work. Everything executes and 0 is returned BUT dialog
does NOT pop up.


I've stripped it down to:
-----------------------------------------------------
(import 'com.sun.jna.Function)
(.invoke (com.sun.jna.Function/getFunction "user32" "MessageBoxA")
Integer (to-array [0 "Hello" "Hello" 0]))
----------------------------------------------------

Exactly the same behavior.

Why?

I'm guessing Win32 idiosyncracy of some sort... any other suggestions?

Thanks!


-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to