Welcome! Please see the About page for a little more info on how this works.

0 votes
in ClojureCLR by

I am porting a C# application (AutoCAD plugin to be exact) from .NET 4.8 to .NET 8.

The code uses some Clojure CLR.
In .NET 4.8 the clojure namespaces were compiled to assemblies (.dll files) using Clojure.Compile.
At runtime, these namespaces were then loaded using clojure.lang.RT.load

However, precompiling clojure clr code is not possible in .NET 8. (https://ask.clojure.org/index.php/13866/is-still-possible-compile-cljr-files-dll-exe-dotent-and-above)

If I understood correctly, the recommended approach is to include the clojure sources with the application and then load the clojure namespaces using clojure.clr.api.Clojure class?
I could not find any examples or documentation on how to set up my application / environment so that clojure.core/load will find my .clj files.

On page
https://github.com/clojure/clojure-clr/wiki/Using-ClojureCLR-in-a-C#-project
there is instructions on how to invoke clojure.core/load

IFn load= clojure.clr.api.Clojure.var("clojure.core", "load");
load.invoke("some.thing");

However, clojure.core/load is documented to use CLASSPATH to find namespaces. Does this also apply in Cojure CLR, i.e. should I define an appropriate CLASSPATH environment variable before calling clojure.core/load ?
https://clojuredocs.org/clojure.core/load

by
Having started w/ this I did not yet get to the point where the application's own Clojure sources (or compiled binaries if that were possible) would be needed. Initializing Clojure itself seems to have problems:

clojure.clr.api.Clojure.var method (being the first method invoked from Clojure library) throws an exception. There are a couple of inner exceptions, the root cause is

    {"Could not locate clojure.core.clj.dll, clojure.core.cljc.dll, clojure/core.clj or clojure/core.cljc on load path.":null}    System.Exception {System.IO.FileNotFoundException}
Whose stack trace shows it was thrown from RT.load :
        StackTrace    "   at clojure.lang.RT.load(String relativePath, Boolean failIfNotFound)\r\n   at clojure.lang.RT.load(String relativePath)\r\n   at clojure.lang.RT..cctor()"    string

I am using the Clojure nuget 1.11.0 on .NET 8. Do I need to include something else as well? Or where might I be going wrong?

Please log in or register to answer this question.

...