BUG: Problems when Function Name Exceeds 127 Characters

ID: Q117797

1.00 1.50 WINDOWS kbtool kbcode kberrmsg kbbuglist

The information in this article applies to:

SYMPTOMS

When you build a Windows DLL with Visual C++, version 1.0, the compiler may hang.

When you build a Windows DLL with Visual C++, version 1.5, under Windows NT, IMPLIB fails with the following error message:

            IMPLIB.EXE - Application Error
   The instruction at "0x0001b14d" referenced memory at "0x00164000".
   The memory could not be "written".

Under Windows or Windows for Workgroups, IMPLIB returns the following DOSXNT error messages:

   DOSXNT : fatal error DX1020: unhandled exception: General
            protection fault

   DOSXNT : system error DX5110: ProcTerm: error(s) occurred during
            process termination

CAUSE

The name of an exported function is longer than 127 characters. This can occur with a decorated name if the function takes several parameters with different data types.

RESOLUTION

With a C++ DLL, shorten the parameter names of the function and/or the function's name until its decorated name is 127 characters or less. With a C DLL, shorten the function name so that it is 127 characters or less.

STATUS

Microsoft has confirmed this to be a bug in Visual C++ for Windows, versions 1.0 and 1.5. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

When the sample code below is compiled in a C++ DLL, TestRoutine's decorated name has 128 characters in it. To reproduce the problems listed above, perform the following steps:

1. Build a DLL using the sample code listed below.

2. If you are using Visual C++ 1.5, run IMPLIB on the resulting DLL.

Sample Code

/* Project Options needed = /Alw /GD

   #include "windows.h"

   #ifdef __cplusplus
   extern "C"
   {
   #endif

   typedef struct tagFIRSTPARAMARGS  FIRSTPARAMARGS;
   typedef FIRSTPARAMARGS *      PFIRSTPARAMARGS;
   struct tagFIRSTPARAMARGS
   { int     dummy; };

   typedef struct tagSECONDPARAMARGS SECONDPARAMARGS;
   typedef SECONDPARAMARGS *     PSECONDPARAMARGS;
   struct tagSECONDPARAMARGS
   { int     dummy; };

   typedef struct tagTHIRDPARAMARGS  THIRDPARAMARGS;
   typedef THIRDPARAMARGS *      PTHIRDPARAMARGS;
   struct tagTHIRDPARAMARGS
   { int     dummy; };

   typedef struct tagFOURTPMARGS     FOURPARGS;
   typedef FOURPARGS *           PFOURTHPARGS;
   struct tagFOURTPMARGS
   { int     dummy; };

   typedef struct tagNOTIFYPARAMARGS NOTIFYPARAMARGS;
   typedef NOTIFYPARAMARGS *     PNOTIFYPARAMARGS;
   struct tagNOTIFYPARAMARGS
   { int     dummy; };

   #ifdef __cplusplus
   }
   #endif

   int PASCAL __export TestRoutine (PFIRSTPARAMARGS pFirstParamArgs,
                               PSECONDPARAMARGS pSecondParamArgs,
                               PTHIRDPARAMARGS pThirdParamArgs,
                               PNOTIFYPARAMARGS pNotifyParamArgs,
                               PFOURTHPARGS pFourthParamArgs)
   { return 0; }

Additional reference words: 1.00 1.50 buglist1.00 buglist1.50 KBCategory: kbtool kbcode kberrmsg kbbuglist KBSubcategory: TlsMisc Keywords : kb16bitonly

Last Reviewed: July 23, 1997