0

I have created a VB.net DLL with Visual Basic Express very simple, this is my code :

Public Class Class1
  Public Function SayHello() As String
    Return "Hello"
  End Function
End Class    
  • I Would like to use this DLL from JAVA with JNA, but Eclipse say me than the procedure "SayHello" doesn't exist in my DLL.
  • When i use tools like "Dependency Walker", my function isn't visible.

So my question : how can i make this function callable and visible ??

Thanks. Vincent.

  • JNA can only access C++ dll. You gonna have to build a c++ wrapper around your VBNet lib. – ortis Dec 29 '14 at 16:59
  • possible duplicate of [Calling Managed Code From Unmanaged C](http://stackoverflow.com/questions/10821109/calling-managed-code-from-unmanaged-c) – xxbbcc Dec 29 '14 at 17:01
  • possible duplicate of [How can I call .NET code from Java?](http://stackoverflow.com/questions/283679/how-can-i-call-net-code-from-java) – Mark Dec 29 '14 at 18:45

1 Answers1

0

Like some of the comments indicate:

JNA is only able to provide "Java bindings" (i.e. lets you call methods from Java) for methods in native PE32 / PE32+ dlls. VB.Net dlls are in contrast always managed dlls.

To distinguish between native and managed dlls you may use e.g. one of the tools dumpbin or corflags; the first shipping with e.g. Visual Studio, the second comes with e.g. recent Microsoft SDKs.

Calling dumpbin /dependents on a questioned managed dll will show a dependency from mscoree.dll.

Calling corflags on a questioned native dll will show an error (s.th. like The specified file does not have a valid managed header)

This info is taken from Is this DLL managed or unmanaged? but has been verified by me, too.

Hille
  • 4,096
  • 2
  • 22
  • 32