Call dll function written in C

I want write a function in win32 dll VC 6.0.
That function is called by a program written in VB 6.0
Who can give me the sample source codes for both side?
I have try many way follow online help, but it always show
"Can't find entry point fun1 in clib"

Thanks
Ginaa
ginaaAsked:
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.

halapayaCommented:
my vc dlls[win32] al the functios i add Extern C infront of each function.

for example;

extern "C" __declspec( dllexport ) long MyFunction (HKEY hKeyRoot,
LPCTSTR lpSubKey,
LPCTSTR lpName,
LPCTSTR lpValue,
unsigned long lType )

here, i have added extern "C" __declspec
in front of the exported function.

I guess u have missed this part.
then, compile and use it like any normal API call from ur VB environment.


0
spojCommented:
check out this site:
http://www.vb-helper.com/HowToAdv.htm

good luck!!!
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
spojCommented:
Find the link:
Create a VC++ DLL file for use with Visual Basic (60K)

* this is a downloadable code

*note*: you may also see some interesting codes that you may also use and study....
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

spojCommented:
additional: the link is found in the lower part of the VB4/VB5/VB6 section of the page.....  

good luck!!!! =)
0
ginaaAuthor Commented:
I have tried the sample, it works, thanks
But in method1 vb program, it must declare alias.
In method2 vc it has a .def file.
Is there any rule or where to find documents for that declaration?

Ginaa
0
spojCommented:
i think it comes with the readme file in it.... i guess.... a certain dll's function could only be found in the documentation of the dll itself..... hope this helps.... thanx..... =) good luck...
0
ginaaAuthor Commented:
I met the problem again.
In my program:

#define DllExport      __declspec(dllexport)

 /* Declare function */
 extern "C" DllExport int fun1(int p1);
.......


 /* Function body */
 extern "C" DllExport int fun1(int p1)
 {
  .....
 }

But in that two line about function header, it said
 error C2059: syntax error : 'string'

But in that two line, I don't write the token 'string'
So what happen? Is there any limit for that use?

Thanks
Ginaa

 
0
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
Visual Basic Classic

From novice to tech pro — start learning today.