Link to home
Start Free TrialLog in
Avatar of ppr
ppr

asked on

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

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
ASKER CERTIFIED SOLUTION
Avatar of nietod
nietod

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ppr
ppr

ASKER

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.






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.
Avatar of ppr

ASKER

Thank you.  It works perfect.