On Windows, you can't load the same DLL twice into one process. I say your best option for achieving parallelism is to have several processes executing concurrently, instead of one process.
Parallel invokation of non reentrant native function using JNA
Pregunta
I'd like to parallelize calls to a native library (DLL) that is not reentrant. Two threads should call the native function in parallel. I want to use JNA to access the DLL. Locks are not a solution since this is not parallelism.
My thoughts until now:
Thread pool with threads holding each a Proxy instance to the DLL loaded with Native.loadLibrary() (it might only work if the DLL can be loaded multiple times in one JVM and do not share any state)
Thread pool with threads holding each a Proxy instance to its own physical DLL with a different name. Each loaded with Native.loadLibrary(). (it might only work if for the same Library interface, multiple DLL can be loaded)
Do I need to load the DLL in different JVMs for parallelism.
Does anyone know whether one of these thoughts might work / or why it can't work. Other suggestions? Thanks, Martin
Solución