An old win32 project does not compile correctly on new vista 64bit machine.
I do not use 64-bit java.
package org.denkweise.coloredconsole;
public final class Console{
static native void setColor(byte fg, byte bg);
}
goes to ColoredConsole32.h:
#include <jni.h>
JNIEXPORT void __cdecl Java_org_denkweise_coloredconsole_Console_setColor(JNIEnv *, jobject, jbyte, jbyte);
goes to ColoredConsole32.cpp:
#include "ColoredConsole32.h"
#include <windows.h>
JNIEXPORT void __cdecl Java_org_denkweise_coloredconsole_Console_setColor(JNIEnv * env, jobject ob, jbyte fg, jbyte bg) {
/*stuff*/
}
and compile successfully via mingw
g++ -D_JNI_IMPLEMENTATION_ -enable-stdcall-fixup -Wl,--kill-at ColoredConsole32.h -Ic:\jdk1.6.0_26\include -Ic:\jdk1.6.0_26\include\win32 -shared -o ColoredConsole.dll
System.loadLibrary works great, but setColor throws an
java.lang.UnsatisfiedLinkError: org.denkweise.coloredconsole.Console.setColor(BB)V
any sugestions?
OK, was my mistake:
the java-method was static, but the 2nd param of my c-method was jobject instead of jclass.
make the method unstatic solves my problem.
Regards