13 messages in net.java.dev.jna.usersRe: [jna-users] Cannot pass any data ...
FromSent OnAttachments
Daniel HorowitzJun 14, 2007 11:27 am 
Timothy WallJun 14, 2007 11:29 am 
Daniel HorowitzJun 14, 2007 11:31 am 
Daniel HorowitzJun 14, 2007 11:39 am 
Timothy WallJun 14, 2007 11:42 am 
Daniel HorowitzJun 14, 2007 11:52 am 
Timothy WallJun 14, 2007 11:53 am 
Timothy WallJun 14, 2007 12:03 pm 
Daniel HorowitzJun 14, 2007 12:13 pm 
Daniel HorowitzJun 14, 2007 12:22 pm 
Timothy WallJun 14, 2007 12:30 pm 
Daniel HorowitzJun 14, 2007 2:11 pm 
Timothy WallJun 14, 2007 2:23 pm 
Actions with this message:
Paste this link in email or IM:
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 dllActions...
From:Daniel Horowitz (dani@gmail.com)
Date:Jun 14, 2007 11:52:48 am
List:net.java.dev.jna.users

I changed my function to __stdcall extern "C" __declspec(dllexport)int __stdcall subscribe(int foo);

int __stdcall subscribe(int foo) { return 0; }

and I changed my java interface to extend Library

Now I am getting -

Exception in thread "main" java.lang.UnsatisfiedLinkError: Cannot locate function 'subscribe'

On 6/14/07, Timothy Wall <twal@dev.java.net> wrote:

On Jun 14, 2007, at 2:32 PM, Daniel Horowitz wrote:

Timothy,

I am. Here is my java interface.

import com.sun.jna.*; import com.sun.jna.win32.*;

public interface GTAPI32 extends StdCallLibrary {

Here are my dll function definitions. all the functions work except subscribe.

#ifndef _TESTAPIB_H_ #define _TESTAPIB_H_

extern "C" __declspec(dllexport)int init();

In that case it's probably your library that isn't declaring its functions as being stdcall, and you should derive from Library rather than StdCallLibrary. I believe the default calling convention is cdecl, even with MSVC. The declspec above typically only tags the function for export. You still need a __stdcall attribute if that's the type of convention you want for it.