
| Last Modification: December 11, 1999 |
Why
do I get a "Cannot Find entry point" error when trying to call my VC++
dll from VB?
This is usually because of name mangling performed by the compiler. When you
export the functions from your VC++ dll using __declspec(dllexport), the symbol
that the compiler really exports is not the actual function name, but one that
it creates for it that includes additional information, like how many bytes it
takes as parameters. That means that if you export a function called MyFunc(),
the compiler might turn up exporting something like _MyFunc@2.
That's not what you wanted, was it?
To correct the issue, forget about using __declspec(dllexport). Instead,
create a .DEF file for your dll and add it to the project (the file usually has
the same name as the dll). Then add an EXPORTS section to it and list all the
functions you export from your library there, like this:
EXPORTS
MyFunc1
MyFunc2
and so on. That will instruct the linker to export those names instead of the mangled ones.