This Question is Possibly Answered

1 "correct" answer available (4 pts) 2 "helpful" answers available (2 pts)
1 Replies Last post: Nov 4, 2009 4:44 PM by Serge Piletsky  
Rob A.   1 posts since
Feb 6, 2009
Currently Being Moderated

Nov 4, 2009 12:39 AM

ArrayIndexOutOfBoundException returning from DLL Native Call

I am receiving the following Error as a result of returning from the "register()" method of a DLL that was created with Delphi. The register call takes a single parameter that is a pointer to a structures.  The function reads initialization information from the structure and updates a few relevent fields in the structure before returning from the method.  I was able to use the Delphi debugger to step through the DLL code, and all code gets executed correctly, up to the point were the function returns the return code, at which point this exeception is thrown.    I have verified that the OUT fields in the structure have the correct values.   In fact this method call was working fine until I added additional code which calls a method in a different DLL from the first DLL, and the debugger revealed that the call to the second DLL returned without issue.

 

Does anyone have any ideas to what can cause the ArrayIndexOutOfBoundsException from simple return a return code from the end of a native C Function call?

 

Thanks, Rob A.

 

java.lang.ArrayIndexOutOfBoundsException
    at com.jniwrapper.Function.invokeCFunc(Native Method)
    at com.jniwrapper.FunctionCall.a(SourceFile:127)
    at com.jniwrapper.FunctionCall.call(SourceFile:35)
    at com.jniwrapper.Function.invoke(SourceFile:188)
    at com.jniwrapper.Function.invoke(SourceFile:212)
    at com.compositeideas.peerlink.peerlet.app.filemanagement.event.driver.win.EventServiceImpl.register(EventServiceImpl.java:97)
    at com.compositeideas.peerlink.peerlet.app.filemanagement.event.driver.win.Activator.start(Activator.java:93)
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:783)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:774)
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:755)
    at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:352)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:370)
    at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1068)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:557)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:464)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:248)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:445)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:227)
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:337)I

Serge Piletsky TeamDev Ltd. 1,066 posts since
Apr 24, 2006
Currently Being Moderated
1. Nov 4, 2009 4:44 PM in response to: Rob A.
Re: ArrayIndexOutOfBoundException returning from DLL Native Call

Hi Rob,

 

I think that the most probable cause of this issue is incorrect function call parameters. Could you please provide me an example that demonstrates that funciton call in Java and a signature of the native funciton itself?

 

Also, please make sure that the funciton calling convention is correctly specified and that you pass function parameters according to the documentaiton for Function.invoke() method: http://www.teamdev.com/downloads/jniwrapper/docs/JNIWrapper-PGuide.html#AEN592

 

-Serge

More Like This

  • Retrieving data ...