Solved

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

Posted on 1998-11-17
4
188 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
  • 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
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.
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.

840 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