Solved

VB 5.0 & VC Interfacing

Posted on 1998-08-04
2
158 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
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
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…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
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.

759 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now