BUG: Link Error L2022 : "__aab : export undefined"

Last reviewed: July 22, 1997
Article ID: Q117386
1.00 1.50 WINDOWS kbtool kbbuglist

The information in this article applies to:

  • The Microsoft C/C++ Compiler (CL.EXE), included with:

        - Microsoft Visual C++ for Windows, versions 1.0 and 1.5
    

SYMPTOMS

The linker generates the following error message when you export a class that contains a user-defined conversion function (conversion operator):

   error L2022: __aab: export undefined

Exporting the conversion function individually also causes the linker to generate the above error message.

CAUSE

The compiler generates incorrect code for the function that implicitly uses the conversion function. LINK is unable to resolve the export.

RESOLUTION

To correct the error, rewrite the function that implicitly calls the conversion function. For the sample code in the "MORE INFORMATION" section below, use one of the following workarounds:

  • void __export Global_Function() {

          Text Mytext;
          String temp = String( Mytext );
    
    }

    -or-

  • void __export Global_Function() {

          Text Mytext;
          String temp;
          temp = Mytext;
    
    }

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

This is not a problem in Visual C++, 32-bit Edition.

MORE INFORMATION

The problem only occurs if the conversion function switches from one class to a user-defined class. The problem does not occur if the class is not a user-defined class. For example:

   Class MyClass
   {
      _export operator int();    // OK
   }

Sample Code

/* Compile options needed: none
*/

   class __export String       // A user defined class
   {
    public :
      String(){};              // Constructor
   };

   class __export Text
   {
    public:
      Text(){}                 // Constructor
      operator String();       // User defined conversion function
    private:
      String m_text;           // Data member
   };

   Text::operator String()     // Function definition
   {
      return m_text;
   }

   void __export Global_Function()
   {
      Text mytext;
      String temp = mytext;    // L2022 Error
   }


Additional reference words: 1.00 1.50 8.00 8.00c
KBCategory: kbtool kbbuglist
KBSubcategory: CPPIss
Keywords : kb16bitonly


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 22, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.