1

I created JNI export dll with visual c++ with one simple function. it work correctly when i use it in my java code with LoadLibrary method.

but when i use Unikey Enveloper and protected this dll it not work in java and this error appear

Invalid access to memory location

when i test this protected dll with visual c++ console application it work correctly.

how can I use protected dll in java LoadLibrary Method?

Visual C++ Code:

extern "C" {

    JNIEXPORT jint JNICALL Java_Bikaran_Start_JniTestFunction(JNIEnv *env, jclass c, jint a, jint b)
    {
        return a + b;
    }
}

JAVA Code :

 package Bikaran;

    public class Start {

        public static native int JniTestFunction(int s, int s1);

        public static void main(String[] args) {

            System.loadLibrary("...");

            System.out.println(JniTestFunction(1,2));
        }
    }
Soroush
  • 33
  • 7
  • [Per this answer:](http://stackoverflow.com/a/40022693/4756299) "DLL files that are wrapped with the enveloper do not load." – Andrew Henle Mar 22 '17 at 12:08
  • Thanks, any suggestions? – Soroush Mar 30 '17 at 08:20
  • If you have a support contract or can file a bug or support request, open a case with the vendor and see how they respond. If they can't get it to work for you or won't fix the problem, consider dropping the product and finding a replacement. That's not good, but if the product doesn't work, it doesn't work. The comments on that other question lead me to believe the product is either very particular to use properly or simply doesn't work - either way the vendor *should* be able to help if it's good product. – Andrew Henle Mar 30 '17 at 09:40

0 Answers0