> I try to build a shared library under MinGW (with g++) for using a JNI calls.
Just a suggestion not intended to answer your original question (simply a thought) and not knowing the particular constraints of your application, but looking into JNA instead of swig/JNI could be useful: https://github.com/twall/jna (I personally consider it to be analogous to p/invoke in .NET).
It's much easier to get working, doesn't require building additional native JNI layers for every platform you support, everything stays in Java, and is less files to ship. It's pretty mature at this point. If performance is a concern, it can actually get near-custom JNI performance.
You could create a minimal C wrapper for calling into the C++ code and then have JNA call into that.
If the idea is to automate the JNI-creation layer because you have a large code base there are tools for doing that to create the JNA layer. Haven't used them myself, though, so YMMV.