Solved

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

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
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 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…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

760 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

18 Experts available now in Live!

Get 1:1 Help Now