Solved

VB 5.0 & VC Interfacing

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
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.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

734 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