Using a C DLL in VB.NET
Posted on 2004-08-16
I have a simple DLL written in C that accesses a binary database. I am writing a VB.NET front-end that is suppose to get to the database via the DLL. (I do have source of the DLL and the database layout). I have quite a few years programming experience in C and VB 6 but almost no experience in VB.NET.
The DLL is EnviroDll.dll
I have been unable to get VB.NET to like my function declaration:
Public Declare Function EnviroOpen Lib "EnviroDll.dll" Alias "_EnviroOpen@4" (ByVal fileName As String) As Long
I realize that I have to watch out for the size of types, which I will worry about next.
1) What do I have to set up to make a VC DLL work within VB.NET?
2) Do I have to add EnviroDll.dll as a Reference or as an Import somewhere in the Projects properties or source file?
3) What is the correct format for the "Public Declare"?
(I've tried lots of combinations and looked at other code but still couldn't come up with a correct combination)