⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tdump.txt

📁 tasm source document descript
💻 TXT
📖 第 1 页 / 共 4 页
字号:
            exports).

          - Do NOT compile with -K or unsigned char's on. You
            will get several undefined symbols in this case.

     If you're linking to the OWL .DLL, DO define _CLASSDLL before
     including OWL.H, and use /c and /C linker options (both Case
     Sensitive Link and Case Sensitive Exports ENABLED).


PROBLEM:
     With an OWL application, wsprintf is undefined in module when
     linking to the static libraries.

SOLUTION:
     Link with /C (case sensitive exports ENABLED).


PROBLEM:
     _main is an undefined symbol.

SOLUTION:
     main is the entry point for every DOS C/C++ program. Make sure
     you write a function called main (all lowercase) in your program.
     If you have a project file loaded, make sure your source code
     file (.c or .cpp file) which has main in it is listed in the .prj
     file. Make sure generate underbars is turned on.


PROBLEM:
     iostream members, like << operator are undefined

SOLUTION:
     Turn options | compiler | code generation | unsigned chars off
     (do not use -K on the command line).


PROBLEM:
     Getting undefined symbols LLSH, SCOPY FMUL, FDIV, etc

SOLUTION:
     Many of the helper functions have changed names from Turbo C
     2.0 to Borland C++. This functions were called from Turbo C 2.0.
     The solution is to recompile any .OBJ or .LIB them with Borland
     C++.


SNOOPING AT THE REAL NAMES:
---------------------------
An .OBJ file is a collection of records. When you call a function or
reference a symbol not defined in your module, the compiler generates
an external definition record in the OBJ. This external definition
record has the symbol which the linker must resolve. When you define a
function, or make storage for some data, the compiler generates a
public definition record for that module (unless you declared the item
as static, that makes it private to that module). One of the tasks of
the Linker is to match Public Definitions and External
Definitions(PUBDEFs and EXTDEFs).

To see the symbols the LINKER has to deal with, use TDUMP.EXE provided
with the Borland C++ package. For example:

    tdump -m -oiEXTDEF some.obj

The above shows all the EXTDEF (external definition) records in an .OBJ
file. Be sure to add the -m option when coding in C++.

    tdump -m -oiPUBDEF some.obj

The above will display all the PUBDEF (public definition) records.

Let's assume you've purchased a third party library and a symbol
provided the library is unresolved; the possible steps in
identifying the problem could include:

     - Create a Listing of symbols in the Library using TLIB. For
       example:
          TLIB NEWLIB.LIB, NEWLIB.LST

     - TDUMP the .OBJ file which was created from the .C/.CPP
       module calling the desired function.
          TDUMP  -m -oiEXTDEF MYCODE.OBJ MYCODE.LST

     - Attempt to find any discrepancies between the name in
       NEWLIB.LST and the one in MYCODE.LST and ascertain that
       the Library does indeed provide the desired function.

Windows Programmers will find the IMPDEF.EXE utility (in addition to
TDUMP and TLIB) a very useful tool to help identify unresolved symbols
when DLLs and/or Import Libraries are involved.


===================================================================
4.  Borland Open Architecture:  Name Mangling
===================================================================
There are four basic forms of encoded names in Borland C++:

1. @className@functionName$args

This encoding denotes a member function Name belonging to
class Name and having arguments args.

Class names are encoded directly. The following example shows a
className in an encoded name:

      @className@...

The class name may be followed by a single digit; the digit value
contains the following bits (these can be combined):

    0x01 : the class uses a far vtable

    0x02 : the class uses the -po calling convention

    0x04 : the class has an RTTI-compatible virtual table; this bit is
           only used when encoding the name of the virtual table for
           the class

The digit is encoded as an ASCII representation of the bit mask
value, with 1 subtracted (so that, for example, the class prefix for a
class 'myfunc' that uses far vtables would be '@myfunc@0').

See the next section on the encoding of function names and argument
types.

2. @functionName$args

This form of encoding denotes a function functionName with arguments
args.

3. @className@dataMember

This form of encoding denotes a static data member dataMember
belonging to class className. Names of classes and data members are
encoded directly. The following example shows a member myMember in
class myClass:

      @myClass@myMember

4. @className@

This name denotes a virtual table for a class className. As mentioned
previously, class names are encoded directly.


Encoding of nested and template classes
---------------------------------------
The following form encodes a name of a class lexically nested within
another class:

  @outer@inner@...

A template instance class encodes the name of the template class, along
with the actual template arguments, in the following way:

  %templateName$arg1$arg2 ..... $argn%

Each actual argument starts with a letter, specifying the kind of
argument it is:

  o  t type argument

  o  i nontype integral argument

  o  g nontype nonmember pointer argument

  o  m nontype member pointer argument

The first letter is followed by the encoded type of the argument. For
a type argument, this code also represents the argument's actual
value. For other kinds of arguments, the type code is followed by $and
the argument value, encoded as an ASCII number or symbol name. An
instance of template<class T, int size> whose name is
vector<long,100>is encoded as shown in the following example:

  %vector$tl$ii$100%


Encoding of function names
--------------------------
The encoded function Name might denote either a function name, a
function such as a function such as a constructor or destructor, an
overloaded operator, or a type conversion.


Ordinary functions
------------------
Ordinary function names are encoded directly, as shown in the
following examples:

  foo(int) --> @foo$qi sna::foo(void) --> @sna@foo$qv

The string $qi denotes the integer argument of function myfunc();'$qv'
denotes no arguments in sna::myfunc.


Constructors, destructors, and overloaded operators
---------------------------------------------------
The following information covers argument encoding in more
detail. Constructors, destructors, and overloaded operators encoded
with a $bcharacter sequence, followed by a character sequence from the
following table:

            Character        Meaning Sequence
            _________________________________

            ctr              constructor
            dtr              destructor
            add              +
            adr              &
            and              &
            arow             ->
            arwm             ->*
            asg              =
            call             ()
            cmp              ~
            coma             ,
            dec              --
            dele             delete
            div              /
            eql              ==
            geq              >=
            gtr              >
            inc              ++
            ind              *
            land             &&
            lor              ||
            leq              <=
            lsh              <<
            lss              <
            mod              %
            mul              *
            neq              !=
            new              new
            not              !
            or               |
            rand             &=
            rdiv             /=
            rlsh             <<=
            rmin             -=
            rmod             %=
            rmul             *=
            ror              |=
            rplu             +=
            rrsh             >>=
            rsh              >>
            rxor             ^=
            sub              -
            subs             []
            xor              ^
            nwa              new[]
            dla              delete []
            __________________________________

The following examples show how arguments are encoded with character
sequences, add, ctr, and dtr from the previous table:

  operator+(int)  -->     @$badd$qi plot::plot() --> @plot@$bctr$qv
  plot::~plot()   --> @plot@$bdtr$qv

The string $qv denotes no arguments in the plot constructor or
destructor.


Type conversions
----------------
Encoding of type conversions accomplished with the $o character
sequence, followed by distinguishing return type of the conversion as
part of function name. The return type follows the rules for argument
encoding, explained later. The lack of arguments in one version is
made explicit in the mangling by adding $qv the end of the encoded
string.

Example:

  myfunc::operator int() --> @myfunc@$oi$qv myfunc::operator char *()
  -->     @myfunc@$opzc$qv

The i following $o in the first example denotes int; the pzc in the
second example denotes a near pointer to an unsigned char.


Encoding of arguments
----------------------
The number and combinations of function arguments make argument
encoding the most complex aspect of name mangling.

Argument lists for functions begin with the characters $q. Type
qualifiers are then encoded as shown in the following table:
         _____________________________

          Character   Meaning Sequence
         _____________________________

           up          huge
           ur          _seg
           u           unsigned
           z           signed
           x           const
           w           volatile
           ____________________________

Encoding of built-in types follows that for applicable type
qualifiers, in accordance with the following table:

           ______________________________

             Character   Meaning Sequence
           ______________________________

             v           void
             c           char
             s           short
             i           int
             l           long
             f           float
             d           double
             g           long double
             e           ...
           ______________________________

Encoding of non-built-in types follows that for applicable type
qualifiers, in accordance with the following table:

         ______________________________

           Character   Meaning Sequence
         ______________________________

           <a digit>   (an enumeration or class name)
           p           near *
           r           near &
           m           far &
           n           far *
           a           array
           M           member pointer (followed by class and
                       base type)
           ______________________________

The appearance of one or more digits indicates that an enumeration or
class name follows; the value of the digit(s) denotes the length of
the name, as shown in the following examples:

  foo::myfunc(myClass near&)      is mangled as @foo@myfunc$qr7myClass
  foo::myfunc(anotherClass near&) is mangled as
  @foo@myfunc$qr12anotherClass

A character x or w may appear after p, r, m, or n to denote a constant
or volatile type qualifier, respectively. The character q appearing
after one of these characters denotes a function with arguments the
follow in the encoded name, up to the appearance of a $ character, and
finally a return type is encoded. The following example show how these
encoding rules are applied:

  @foo@myfunc$qpxzc      is mangled as foo::myfunc(const char near*)
  @func1$qxi is mangled as   func1(const int) @foo@myfunc$qpqii$i is
  mangled as foo:myfunc(int (near*)(int,int))

Array types are encoded as a, followed by a dimension encoded as an
ASCII decimal number and a $, and finally the element type, as shown
in the following example.

  myfunc( int (*x)[20] )    is mangled as @myfunc$qpa20$i

Encoded arguments are concatenated in the order of appearance in the
function call. The character t followed by an ASCII character encodes
the arguments when a number of identical non-builtin types are
function arguments. The ASCII character, ranging from ASCII 31H -
39Hand 61H - 7FH (1 to 9 and a onward), denotes which argument type to
duplicate, as shown in the following example:

  @plot@func1$qdddiiilllpzctata is unmangled to plot::func1(double,
          double, double, int, int, int, long, long, long, char near*,
          char near*, char near*)

The two duplicate ta character sequences at the end of the encoded
name denote the tenth argument, encoded as pzc.

/*************************************************************************/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -