access .dll functions

mak

New member
Joined
Jan 28, 2008
Messages
2
Programming Experience
1-3
Hi,

I am trying to access a function in test.dll from within a VB.net 2005 program.

I have only a header file of a C programm stating :

const char* __stdcall Fctnname (void);

Could anybody tell me how to declare this function in VB.net?

Declare Auto Function newFctnname Lib "test.dll" Alias "Fctnname" () As <MarshalAs(UnmanagedType.LPStr)> String
doesnt work and produces a fatal runtime error

thanks a lot
Marc
 
Where is your DLL located? It must be in the same folder as your app or the system32 folder.

thank you
The dll works fine, I'm also calling other functions of this dll.
Its just the return type (some kind of string), defined as

const char* __stdcall

which I don't know how to interface in VB.net 2005. I lost the overview over C strings, VB strings, B strings, pointer to pointers to the string, Unicode, COM, 16bit, win32, .net, intel memory conventions... probably not all of these things interfere here but it's just too much for hobby-programmers to keep in mind.
but I hope the experts kept the overview and know this by heart!
Probably the .dll was made with a visual C++ version, but as this is not for sure I would maybe have to try two, three declarations and see which one is the correct one.
 
Back
Top