delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/04/30/08:57:27

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-0.0 required=5.0 tests=BAYES_40,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
X-Host-mx2: True
MIME-Version: 1.0
Subject: 1.5.24-2 Problem with cpp and mixed unicode/ansi source files
Date: Fri, 30 Apr 2010 08:57:10 -0400
Message-ID: <8F37BF6F420455468C4BD57DD6BE199005907924@cobra.pc.cognex.com>
From: "Davis, Jason" <Jason DOT Davis AT cognex DOT com>
To: <cygwin AT cygwin DOT com>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

We use cygwin's cpp.exe (gcc, I guess) to pre-process .rc files before they=
 get converted into compiled resource files.  In our source tree there's a =
file foo.rc, which is 8-bit ansi, which declares some stuff and then has th=
e following lines:

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE 9, 1
#pragma code_page(1252)
#endif //_WIN32
#include "afxres.rc"         // Standard components
#include "afxprint.rc"       // printing/print preview resources
#endif

Those two #includes are files shipped with the Visual Studio Windows SDK.

Now this worked fine under Visual C 6/7/8/9.  However, under VC10, suddenly=
 those Microsoft include files are unicode.  (Note: not an issue with unico=
de file names.. these have 8-bit file names and unicode contents).  Now whe=
n the afxres.rc and afxprint.rc files are included, the contents are insert=
ed exactly as-is into the output stream, rather than interpreted.  So the o=
utput file looks normal for a while, and then suddenly there's a bunch of b=
ox-char-box-char-etc with the (formerly unicode) contents of the afxres.rc =
file, then the same for afxprint.rc, and then some normal output again.

As a test, I changed foo.rc itself to be a unicode text file, and then its =
contents were similarly copied into the result file.

I found http://cygwin.com/cygwin-ug-net/setup-locale.html , but I'm not sur=
e that's my issue, really.

I don't know if this issue can be solved with a unicode code_page, or an up=
grade to a newer version of cygwin, or a command-line switch to the executa=
ble, or just I'm out of luck.

Can anyone shed some light on my problem?  My apologies if this is the wron=
g mailing list for this question.  Thank you.

Jason Davis

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019