Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DLL (Delphi) with ADO (connection and query) not work in Java (using jna)

Tags:

java

dll

delphi

jna

I have a dll (Delphi) that contains a ADOConnection and ADOQuery, but when running the called DLL in java (using JNA) appear some error information to the console (below):

A fatal error has been detected by the Java Runtime Environment:

Internal Error (0xeedfade), pid=4400, tid=3840

JRE version: 6.0_25-b06 Java VM: Java HotSpot(TM) Client VM (20.0-b11 mixed mode, sharing windows-x86 ) Problematic frame: C [KERNELBASE.dll+0x812f]

An error report file with more information is saved as: C:\Users\Mmn1\Documents\NetBeansProjects\FLMOPDL\hs_err_pid4400.log

If you would like to submit a bug report, please visit:
http://java.sun.com/webapps/bugreport/crash.jsp The crash happened outside the Java Virtual Machine in native code. See problematic frame for where to report the bug.

What bug is this? (I realized that it is only happens if I have a form or as a component in the case ADOConnection ADOQuery and if I remove these components and perform a simple function, it works normally).

Edit:

A similar exemple bellow:

library TESTLIB;
{$DEFINE TESTLIB}

uses
  System.SysUtils,
  System.Classes,
  TestInt in 'TestInt.pas',
  Vcl.Dialogs,
  sharemem,
  Data.DB, Data.Win.ADODB;

{$R *.res}

function MyReturn(x: Integer; Test: PTest): Boolean; stdcall;
var
  ado: TADOQuery;
begin
    Result := True;
    //ado := TADOQuery.Create(nil); <- With this i got a error!
end;

exports MyReturn;

begin
end.

interface in Java

public interface TestInt extends StdCallLibrary {
    TestInt INSTANCE = (TestInt)Native.loadLibrary("C:/test/Win32/Debug/TESTLIB", TestInt.class);

    class Test extends Structure {
        public String vResult;

        public Test() { }
        public Test(int x, Pointer p) {
            super(p);
            read();
        }
        protected List getFieldOrder() { return Arrays.asList(new String[] { "vResult" }); }
    }

    Boolean MyReturn(int x, Test test);
}

conclusion: when I use a component, this error raise. Thanks for help.

like image 280
Saureco Avatar asked Nov 25 '25 07:11

Saureco


1 Answers

According to the message, the problem is

outside the Java Virtual Machine

in this case, it's probably in the Delphi code.

You might want to contact the developer(s) of the Delphi code and see if they can assist in troubleshooting the issue, or browse the code yourself to see what's going on. The hs_err_pid4400.log file will contain valuable information for them.

Either way, without Delphi source code it's hard to troubleshoot the issue.

like image 62
mthmulders Avatar answered Nov 27 '25 20:11

mthmulders



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!