?
Solved

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

Posted on 1998-11-17
4
Medium Priority
?
193 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 200 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
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 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.
Suggested Courses

762 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