Registrations are now open. Join us today!
There is still a lot of work to do on the wiki yet! More information about editing can be found here.
Already have an account?

Microsoft KB Archive/102700

From BetaArchive Wiki

FIX: No String in EXE from #pragma Comment(exestr,

Q102700





The information in this article applies to:


  • Microsoft LINK for MS-DOS
  • Microsoft C/C++ for MS-DOS, version 8.0
  • Microsoft Visual C++, version 1.0





SYMPTOMS

An attempt to use #pragma comment to place a text string into an executable module fails.



RESOLUTION

The sample code below demonstrates two methods to work around this problem. The first method declares a character array in the application that contains the string to embed in the file. This method places the string into the application's data segment. The second method is similar to the first except that the compiler places the string into the application's code segment, and therefore it does not consume space in the data segment. Either of these methods loads the string into memory when the application runs.

A third method is available to applications developed for the Microsoft Windows operating system. Place the string into a STRINGTABLE resource. If desired, you can specify the LOADONCALL attribute so the string is not loaded into memory until the application requires it.



STATUS

Microsoft has confirmed this to be a problem in Microsoft LINK version 5.5 for MS-DOS. This problem was corrected in Microsoft LINK version 5.6 for MS-DOS. This is not a problem in Microsoft LINK version 1.0 for Windows NT.



MORE INFORMATION

The #pragma comment(exestr, <string>) statement places <string> into the object file. LINK places the string into the executable file; you can find it with an application that searches executable files for strings. However, the loader does not load the string into memory. You can use comment strings to store a version number or similar information into your executable file.


Sample Code

/*
 * Compiler options needed: none
 */ 

#pragma comment(exestr, "Comment EXESTR")

/*
 * Other methods
 * char data_exestr[] = "Data EXESTR";
 * char __based(__segname("_CODE"))code_exestr[] = "Code EXESTR";
 */ 

void main()
{
}
 

Additional query words: 5.50 8.00

Keywords : kb16bitonly
Issue type :
Technology : kbVCsearch kbAudDeveloper kbPTProdChange kbvc100 kbZNotKeyword3 kbLINKSearch


Last Reviewed: May 9, 2001
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.