There's information out there on how to call C APIs from Groovy, but we need to do the opposite - call Groovy scripts from a C program.
We're thinking to start a Groovy "main" that invokes a C function through JNI. This gets the JVM going and that C function is essentially our C program. The thing we can't figure out is how to call an arbitrary Groovy function from within this C program.
What we'd like to do is somehow invoke GroovyClassLoader() inside our C code to create objects mapping to blobs of Groovy script, and then call the various methods as we need them.
We generally want to stay away from solutions involving multiple processes, pipes, sockets and so forth if at all possible. The data passed to our Groovy functions can be large, and marshalling/un-marshalling it would be way too slow for what we're trying to do.
Thanks in advance to anyone that might point us to a good example!