Timothy,
I am. Here is my java interface.
import com.sun.jna.*;
import com.sun.jna.win32.*;
public interface GTAPI32 extends StdCallLibrary {
interface WNDENUMPROC extends StdCallCallback {
boolean callback(Pointer hWnd, Pointer arg);
}
public static class HGTBSESSION extends Structure {
public Pointer unused;
}
GTAPI32 INSTANCE = (GTAPI32)
Native.loadLibrary("TestAPIB", GTAPI32.class);
int init();
int login();
int subscribe(int foo);
int destroy();
int logout();
}
On 6/14/07, Timothy Wall <twal...@dev.java.net> wrote:
On Jun 14, 2007, at 2:28 PM, Daniel Horowitz wrote:
Hey,
I am able to invoke functions in my dll that do not take any
arguments. But if the function takes arguments of any type, and I
call the function, java crashes with the following message -
#
# An unexpected error has been detected by Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x009dfa9c,
pid=3616, tid=3192
#
# Java VM: Java HotSpot(TM) Client VM (1.6.0_01-b06 mixed mode)
# Problematic frame:
# C 0x009dfa9c
Here are my dll function definitions. all the functions work except
subscribe.
#ifndef _TESTAPIB_H_
#define _TESTAPIB_H_
extern "C" __declspec(dllexport)int init();
extern "C" __declspec(dllexport)int destroy();
extern "C" __declspec(dllexport)int login();
extern "C" __declspec(dllexport)int logout();
extern "C" __declspec(dllexport)int subscribe(int foo);
#endif
Probably you need to derive from StdCallLibrary rather than Library,
so that w32 stdcall calling convention is used.