Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exporting C/C++ DLL functions to VB

Status
Not open for further replies.

buzznick

IS-IT--Management
Dec 29, 2004
39
US
Hi, I'm writing a DLL in C/C++ that needs to export a couple of functions to be used by a Visual Basic program. However, I'm having some trouble getting the Visual Basic to read the exported C functions.

They are very simple functions, eg:

extern "C" __declspec(dllexport)
void test_get_string(char* str)
{
strcpy(str,"Hello World!");
}

extern "C" __declspec(dllexport)
int test_get_number(void)
{
return 123456;
}

The problem is that I don't know VB at all but that's all my client uses. He says I'm not exporting the functions correctly in the DLL because he's getting a "453" error (whatever that is!).

It was my understanding that simple C functions (as above) inside a DLL could be called from VB no problem.

Is it something I did wrong or is the client doing something wrong? Either way, how do I fix it?

Many thanks!
 
Hi Wazaski, no problem. It's always annoying when trying to find solutions to a problem and google it only to find others asking same question but no solution posted. :-S

Nick

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top