

![]() | 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: |
3 messages in net.java.dev.jna.usersRe: [jna-users] procedure not found p...| From | Sent On | Attachments |
|---|---|---|
| Tim....@hitachigst.com | May 27, 2008 3:14 pm | |
| Timothy Wall | May 27, 2008 3:16 pm | |
| Timothy Wall | May 27, 2008 4:38 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] procedure not found problem | Actions... |
|---|---|---|
| From: | Timothy Wall (twal...@dev.java.net) | |
| Date: | May 27, 2008 3:16:08 pm | |
| List: | net.java.dev.jna.users | |
you probably need to use the StdCallFunctionMapper.
On May 27, 2008, at 6:15 PM, Tim....@hitachigst.com wrote:
I am a java newbie trying to interface to a USB camera through a dll provided with the camera. I essentially copied the kernel32 jna example (which worked fine for me) but here I get the error:
===================================== java.lang.UnsatisfiedLinkError: Error looking up function 'FclInitialize': The specified procedure could not be found.
at com.sun.jna.Function.<init>(Function.java:126) at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java: 219) at com.sun.jna.Library$Handler.invoke(Library.java:191) at $Proxy3.FclInitialize(Unknown Source) at FcFunctions.main(FcFunctions.java:55) ===========================================
The dll is FcApi.dll. Here is the documentation for the primary function I need to access (if I get this function, I can presumably get the rest):
=============================== int FclInitialize( LPCSTR pStrName, OUT int& index, IN CapInfoStruct capInfo, OUT HANDLE* pHCamImg);
Purpose: This function obtains the handle required for subsequent API calls.
Parameters: •(in) pStrName is the string identifying the driver to be used. This string can be set to any string, such as "FcLab USB Module". •(out) index is a number that can differentiate between devices •(in) capInfo is the initial image capture parameter structure. User can change it later. •(out) pHCamImg is the pointer to the variable receiving the device handle.
Sample: /* Call the function*/ nResult=FclInitialize(“My Module”, index, capInfo, &hCamImg); /* Check status*/ if (ApiSuccess != nResult)
Comments: Any function call needs a handle that is returned by this function. So this function should be called before any other function call. =======================================
The required structure has the following documentation:
============================= struct CapInfoStruct { unsigned char *pBuffer; //Need to point to a buffer with enough memory for image data unsigned long ExposeTime; //1- 500 (preferable >20) ,millisecond unsigned char Gain[3]; //0 – 63 for each unsigned long Height; //0 – 1024, pixel (for FC1000), 0-1200 (for FC2000) unsigned long Width; //0 – 1280, pixel (for FC1000), 0-1600 (for FC2000) unsigned long OffsetX; //0 – 1024, pixel (for FC1000), 0-1200 (for FC2000) unsigned long OffsetY; //0 – 1280, pixel (for FC1000), 0-1600 (for FC2000) unsigned char Control; //vary. }; ===============================
Here is my attempt at a JNA interface: ====================================== // FcApi.java
import com.sun.jna.*; import com.sun.jna.ptr.*; // IntByReference
public interface FcApi extends StdCallLibrary { public static class CapInfoStruct extends Structure { public byte pBuffer []; //Need to point to a buffer with enough memory for image data public long ExposeTime; //1- 500 (preferable
20) ,millisecond
public byte Gain []; //0 – 63 for each public long Height; //0 – 1024, pixel (for FC1000), 0-1200 (for FC2000) public long Width; //0 – 1280, pixel (for FC1000), 0-1600 (for FC2000) public long OffsetX; //0 – 1024, pixel (for FC1000), 0-1200 (for FC2000) public long OffsetY; //0 – 1280, pixel (for FC1000), 0-1600 (for FC2000) public byte Control; //vary. }
int FclInitialize(String pStrName, IntByReference index, CapInfoStruct capInfo, PointerByReference pHCamImg);
int FclUninitialize(PointerByReference phCamImg); } ==========================================
and here is the code for using this interface: ====================================== import com.sun.jna.*; import com.sun.jna.ptr.*; // IntByReference
public class FcFunctions { public static void main (String [] args) { FcApi lib = (FcApi) Native.loadLibrary ("FcApi", FcApi.class); FcApi.CapInfoStruct cInfo = new FcApi.CapInfoStruct();
int Rval = -99;
int BufferSize = 1280*1024; cInfo.pBuffer = new byte[BufferSize]; cInfo.Gain = new byte[3];
cInfo.Width = 600; cInfo.Height = 400; cInfo.Gain[0] = 30; cInfo.Gain[1] = 30; cInfo.Gain[2] = 42; cInfo.ExposeTime = 25; cInfo.OffsetX = 0; cInfo.OffsetY = 0; cInfo.Control = 0;
IntByReference nIndex = new IntByReference();; PointerByReference pHCam = new PointerByReference(); String pName = "FcLab USB Module";
Rval = lib.FclInitialize(pName, nIndex, cInfo, pHCam); // this line generates runtime error Rval = lib.FclUninitialize(pHCam);
} } ======================================
This compiles but running main gives the runtime error shown at the top of this note when it gets to the FclInitialize line.
I am running windows xp pro with service pack 2 and jna 3.0.3. The FcApi.dll is in the windows/system32 directory (as in the kernel32 example).
Any suggestions you have would be greatly appreciated.
Tim Strand







