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
Solved

Cant find DLL reference point

Posted on 2000-02-23
3
161 Views
Last Modified: 2012-05-04
I used C++ V6 to compile and link a DLL that includes function calls.  When I try to access functions from this DLL, I get the run-time error "Can't find DLL entry point ClfyConnect in notes2clarifydll".

I am thinking the problem is with the C++ DLL.

//////////////////////////
Sample calling code (VB6)...
Private Declare Function ClfyConnect Lib "notes2clarifydll" _
    (ByVal sServer As String, ByVal sDatabase As String, _
     ByVal sUsername As String, ByVal sPassword As String) As Long

////////////////////////////////
Sample C++ code generating the DLL...

__declspec(dllexport) long __stdcall ClfyConnect(char *,char *,char *,char *);
0
Comment
Question by:GregoryGr
  • 3
3 Comments
 
LVL 22

Accepted Solution

by:
nietod earned 100 total points
ID: 2551666
The problem is name decoration.  I have a "stock answer" I'll post it.
0
 
LVL 22

Expert Comment

by:nietod
ID: 2551678
C++ "decorates" or "mangles" function names by appending a "code" to the end of the name that expresses the parameters passed to the function.  This is used to impliment function overloading, where 2 or more distinct functions have the same name and different parameters.  (Apparently they have the same name--C++ mangles the names so they don't actually have the same name).  

The function is exported with the mangeled name, so you aren't actually specifying the right name in VB.  You can use dumpbin to verify this, you should see the function exported with a mangeled name and that is the name that you woudl have to specify to VB

To fix this problem, you can specify the mangeled name to VB, or--better--declared the function as "extern "C" ".  This dissables name mangeling on the function.

Let me know if you have questions.
0
 
LVL 22

Expert Comment

by:nietod
ID: 2551695
One more thing.  This may not be quite sufficient.  There is one other type of name decoration and this doesn't dissable that.  If after using extern "C" you find that the exported name (check with dumpbin) ends with a "@" followed by a number, they this is the standard call decoration.  

To remove this decoration you need to place an entry in the DLL's module defintion file (.def).  The entry should appear in the EXPORTS section and should just contain the name of the function.  for example

// in your .cpp file

extern "C" __declspec(dllexport) long __stdcall ClfyConnect(char *,char *,char *,char *);

// in your .def file.
EXPORTS
   ClfyConnect

let me know if you have any questions
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
returning a dereferenced pts in C++ 10 158
C++ to C# code conversion issue 4 112
Dynamically allocate memory 9 63
Issues with C++ Class 19 101
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
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 goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
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…

828 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