Solved

VB 5.0 & VC Interfacing

Posted on 1998-08-04
2
165 Views
Last Modified: 2010-04-02
How does one call a function written in Visual C++ from Visual Basic 5.0??
0
Comment
Question by:pmaurin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 22

Expert Comment

by:nietod
ID: 1169354
First of all, on the C++ side you need to declare the function as extern "C" to dissable the name decoraton.  Like
extern "C" int F(int i)
{
 return i + 1;
}

You also need to declare the function on the VB side so that the correct parameters are passed to VC.  I can't help you there.
0
 
LVL 2

Accepted Solution

by:
shchuka earned 100 total points
ID: 1169355
See my answer to this question in the VB area.
basically, you need
void _declspec(DllExport) _stdcall CFunction(paramlist)
Also you need the DEF file:
LIBRARY
    dll-name
EXPORT
    CFunction

In VB then you declare it as
declare sub (or function) CFunction lib "Whatever.dll" (paramlist)

and call it from VB as any other VB function.

declare
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
Suggested Courses

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question