

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
13 messages in net.java.dev.jna.usersRe: [jna-users] Cannot pass any data ...| From | Sent On | Attachments |
|---|---|---|
| Daniel Horowitz | Jun 14, 2007 11:27 am | |
| Timothy Wall | Jun 14, 2007 11:29 am | |
| Daniel Horowitz | Jun 14, 2007 11:31 am | |
| Daniel Horowitz | Jun 14, 2007 11:39 am | |
| Timothy Wall | Jun 14, 2007 11:42 am | |
| Daniel Horowitz | Jun 14, 2007 11:52 am | |
| Timothy Wall | Jun 14, 2007 11:53 am | |
| Timothy Wall | Jun 14, 2007 12:03 pm | |
| Daniel Horowitz | Jun 14, 2007 12:13 pm | |
| Daniel Horowitz | Jun 14, 2007 12:22 pm | |
| Timothy Wall | Jun 14, 2007 12:30 pm | |
| Daniel Horowitz | Jun 14, 2007 2:11 pm | |
| Timothy Wall | Jun 14, 2007 2:23 pm |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | Re: [jna-users] Cannot pass any data to native dll | Actions... |
|---|---|---|
| From: | Daniel Horowitz (dani...@gmail.com) | |
| Date: | Jun 14, 2007 11:39:36 am | |
| List: | net.java.dev.jna.users | |
Some more info that might clear things up - I am compiling my dll with VS2005 and my project settings are
Calling convention - __cdecl Compile as - C++
Through reading the forms i tried __stdcall but then jna cant find any of my functions. Then I tried compile as C, and the compiler complained about my extern definitions being strings (very strange).
On 6/14/07, Daniel Horowitz <dani...@gmail.com> wrote:
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.







