Jump to content
Excelsior Forums
Sign in to follow this  
FrankFFM

Call DDL vom Excel VB

Recommended Posts

I tried to call the Java DDL from Excel VBA.

1) I modified the function in \samples\DDL\imported\dll:

public class dllClass

{

 static public String printSomething(String aString)

 {

   //System.out.println ("I'm a method from DLL");

    return aString + aString;

 }

}

2) I copied dll153.dll into \systems32 directory.

3) I used the following code from Excel VBA to call the function:

Option Explicit

'Declare use of DLL

Private Declare Function printSomething Lib "dll153.dll" (ByVal v1 As String) As String

Private Function test()

  Dim s As String

  Dim d As String

  s = "TestEin"

  d = printSomething(s)

End Function

I received the error message (translated from german):

RunTimeError 453: DLL-Function not found

What went wrong?

Share this post


Link to post
Share on other sites

To invoke Java DLLs from other languages you should use Invocation API. See the samples in samples\Invocation\COM for details

Share this post


Link to post
Share on other sites

What when the dll is part of an application (java compiled with Excelsior) just to allow other programms to access some functionality provided by the java application?

Share this post


Link to post
Share on other sites

Excelsior JET is essentially a JVM with pre-compilation, otherwise it would not be possible to certify it for compatibility (which we plan to do later this year). So the only way to call a native code DLL from JET-compiled EXE, or call a JET-compiled DLL from a native code EXE is via JNI.

In case of VB, JNI does not work directly (in part due to VB runtime launching helper threads without telling anyone :( ), so you have to use COM wrappers.

Share this post


Link to post
Share on other sites
Sign in to follow this  

×