Solved

Am I missing an option in C++ Builder 3 ??

Posted on 1998-11-17
4
191 Views
Last Modified: 2010-04-01
I'm developping a DLL using Borland C++ Builder 3.  I've 1 unit containing all the exported functions and several units containing internal functions.  When I compile the project in the IDE and take a Quick View, the ordinals of the exported functions are 0,1,2,3,etc... .  However, when I compile the project from the command-line, using an rsp file the ordinals are totally different.  Can anyone explain this and come up with a solution to tune both methods onto each other ??

Thank you,

Johan
0
Comment
Question by:ppr
[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
  • 2
4 Comments
 
LVL 22

Accepted Solution

by:
nietod earned 50 total points
ID: 1178033
If you intend to link by ordinal, then you must use a .def file to specify the ordinals for the DLL.  (Not really recommended in C++)  Otherwise, just use link by name (the default) and don't worry about this.

Let me know if you have questions.
0
 

Author Comment

by:ppr
ID: 1178034
I need a DLL where the ordinals correspond with the order of the functions.  I use the _export keyword in the function declaration, so I thought I didn't had to use a .def file.






0
 
LVL 22

Expert Comment

by:nietod
ID: 1178035
No, if you want to use ordinals, you must have a .def file.  However, .def's in C++ pose an extra challenge--name decoration.  C++ "decorates" function names with a "code" that expresses the parameters types the function expects.  This is so that overloaded functions have unique names.  If you use a .def file you will need to yse the decorated names, not the names you specified in the source code.  Unfortuantely, you don't know the decorated name (although you can see it by looking with dumpbin.)  But specifying a decorated names is ugly. A better idea is to use the "extern "C" " declaration on your exported functins.  This dissables name decoration (and overloading) on the functions you specify.  Look at extern "C" in the docs.  Let me know if you have any questions.
0
 

Author Comment

by:ppr
ID: 1178036
Thank you.  It works perfect.
0

Featured Post

Industry Leaders: 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

Suggested Solutions

Title # Comments Views Activity
Fully specialized class template function 21 146
C++ to C# code conversion issue 4 120
Dialogbox API leak? 18 109
Issues with C++ Class 19 108
Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
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…
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 learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

726 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