Solved

Cant find DLL reference point

Posted on 2000-02-23
3
158 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
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 goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

708 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

13 Experts available now in Live!

Get 1:1 Help Now