简体   繁体   中英

Vb.net DLL method not visible

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.

Like some of the comments indicate:

JNA is only able to provide "Java bindings" (ie 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 eg one of the tools dumpbin or corflags ; the first shipping with eg Visual Studio, the second comes with eg 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM