Visual Basic and Dll

I have to call from VB6 a function belonging to a Dll written by me in Windows ANSI C.
Function is Exported like this:
#define      EXPORT                        extern __declspec (dllexport)
EXPORT BOOL CALLBACK DllInitByPhonema(HWND);

From VB,I've a client that declare the function like this:
Declare Function DllInitByPhonema Lib "rtpbuffer.dll" _
(ByVal Hwnd As Long) As Boolean

and then call :
DllInitByPhonema(Me.Hwnd)

Problem is error 453 that is missing entry point in dll's function.Don't know why,'cause this is the standard procedure of calling function in system dll like kernel32 or user32.
Help please.
cbonjoviAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

GustavoValdesCommented:
Becouse you're making a non Active X Dll, you must tell VB explicitly wich functions are available within your DLL, you do that by using a .DEF file that includes all the files that must be exportable.
0
zealsoftCommented:
You use __declspec (dllexport) to export the funtion, VC++ and other C compiler will export the function as a C function. But VB supports only "stdcall" functions. So you need to change the C declation as follows,

BOOL __stdcall DllInitByPhonema(HWND);

And then create a .DEF file and add it into your VC++ project. In .DEF file, add following lines,

EXPORTS
   DllInitByPhonema

Recompile your DLL.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.