On Tue, May 2, 2023 at 2:37 AM Mark Evenson <evenson@panix.com> wrote:

A patch for ABCL to add this would be appreciated, but the implementation should somehow be changed to the “standard” load for JNA by the ABCL-ASDF contrib, namely something like

   (require :abcl-contrib)
   (asdf:make :jna)


As I understand it, Alan’s implementation only works if ABCL-ASDF:RESOLVE is present, meaning it cannot be put “as is” in the base ABCL system.  I believe this is possible because the OWL2 application uses the ABCL-AIO build of ABCL which merges abcl.jar which abcl-contrib.jar, but I could be wrong. 

It's true that I use aio. TBH I've never understood the point of separating the contribs from the base. File size isn't an issue any more. What's the upside of splitting them apart? A bit of extra time indexing the classes in the jar?

Conceptually, we should somehow place the implementation of setting environment variables via the C syscall as a patch in the contrib system in a new contrib called (?) USE-POSIX-SYSCALLS (terrible name, please change).  Such a new contrib would a) depend on
 JNA and b) have to be used via

   (asdf:make :use-posix-syscalls)

I don't know what asdf:make does. I tried it in a situation (autoloading the java parser when #1 was used the first time) where I expected it to load a system and it didn't seem to.

Would it be sufficient to do something like:

(defun ensure-jna-loaded ()
  (or *jna-loaded*
      (progn
        (when (not (ignore-errors (find-java-class 'jna.nativelibrary)))
          (require 'abcl-asdf)
          (add-to-classpath (funcall (intern "RESOLVE" 'abcl-asdf "net.java.dev.jna/jna/LATEST")))
          (setq *jna-loaded* t)))))

This is assuming that abcl-contrib is available. Since I've never used contrib separately, I'm not sure what the standard pattern is for using something in contrib if it's not on the classpath.
Mind you find-java-class is also part of jss, which is a contrib, which I always load...

Bottom line is that I don't know how to package this under whatever the assumptions are when not using abcl-aio

Alan






--
"A screaming comes across the sky.  It has happened before but there is nothing
to compare to it now."