Dynamically collect the list of native lib functions and signatures (via JNA)

Viewed 29

I need to call standard os functions from within Java code. I managed to successfully load the lib using the following construct:

interface CStdLib extends Library {

    /**
     * C STDLIB instance.
     */
    CStdLib CSTDLIB = CStdLib.class.cast(
        Native.load("c", CStdLib.class)
    );

    int syscall(int cid, Object... args);
}

I also can call a function (e.g. gettimeofday) if explicitly define relevant parameter structures as Java interfaces.

But I would like to call any system function without modifications in Java code.
So the question is: is there a way to dynamically find out signature and required structures for arbitrary function from a given native library (libc in this case)?
And/or can I find out somehow the list of available functions for the lib?

0 Answers
Related