Provide FFI support for C/C++

Description

Hi,
I need to call Clojure from C. My goal is to pass char buffer (length up to 4000 char) to Clojure in order to get rid of an old Cobol module.
I have been able to make it by creating a jar via Leiningen and accessing it using JNI and it works well but I have a performance issue.
I assume there is high latency going from C to Clojure through Java back and forth.

Clojure is a great language with awesome functionality but in my humble opinion, it misses a fast FFI support for native language such as C...

Environment

None

Activity

Show:
Alex Miller
February 2, 2019, 2:37 AM

You're not going "through" Java; Clojure emits bytecode that runs on the JVM just like Java bytecode. Your question is really about C to JVM.

There are lots of ways to do interprocess communication with Java - io streams, memory mapped files, etc. I suspect there actually is a better solution for what you're trying to do, but I'm not an expert in this area. I would recommend spending some more time investigating what others do for this in Java.

I'm going to decline this ticket as I'm not sure what Clojure would do that would be beyond existing solutions that Java/JVM provides and this is just not something we're going to work on in the foreseeable future.

Declined

Assignee

Unassigned

Reporter

import

Labels

Approval

None

Patch

None

Affects versions

Priority

Major