Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I was able to get it to work doing the following:</p> <p>First I changed your code a bit, I was having trouble with the namespace and the compiler thinking the dots were directories. So I ended up with this.</p> <pre><code>(ns hello (:require [clojure.core]) (:gen-class :methods [#^{:static true} [output [int int] int]])) (defn output [a b] (+ a b)) (defn -output [a b] (output a b)) (defn -main [] (println (str "(+ 5 10): " (output 5 10)))) </code></pre> <p>Next I compiled it by calling:</p> <p><code>Clojure.Compile.exe hello</code></p> <p>This creates several files: hello.clj.dll, hello.clj.pdb, hello.exe, and hello.pdb You can execute hello.exe and it should run the -main function.</p> <p>Next I created a simple C# console application. I then added the following references: Clojure.dll, hello.clj.dll, and hello.exe</p> <p>Here is the code of the console app:</p> <pre><code>using System; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { hello h = new hello(); System.Console.WriteLine(h.output(5, 9)); System.Console.ReadLine(); } } } </code></pre> <p>As you can see, you should be able to create and use the hello class, it resides in the hello.exe assembly. I am not why the function "output" is not static, I assume it's a bug in the CLR compiler. I also had to use the 1.2.0 version of ClojureCLR as the latest was throwing assembly not found exceptions.</p> <p>In order to execute the application, make sure to set the clojure.load.path environment variable to where your Clojure binaries reside.</p> <p>Hope this helps.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload