You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Arsen Chaloyan <ac...@yahoo.com> on 2013/11/27 19:38:57 UTC

APR resource script files on Windows

Hi,

I've recently addressed locally another issue which had existed for a while and would like to bring it up
 to the list in case it matters. So, the problem is in the following.

An attempt to open an APR resource script file (libapr.rc or libaprutil.rc) in the Resource View crashes Visual Studio (true at least for VS2005 and VS2010). This is clearly a Microsoft bug, which is related to the use of Resource View only, Resource Compiler works normally, but still...

I had no
 clue what could be the reason until recently. Trying to use VS2013 for the same, instead of the "expected crash", I got an error message, which eventually pointed out to the definition of APR_LICENSE being too long. The following change in libapr.rc made the trick.

+#ifdef APSTUDIO_INVOKED
+#define APR_LICENSE \
+  "A brief description goes here up to 264 characters."
+#else
 #define APR_LICENSE \
   "Licensed to the Apache Software Foundation (ASF) under one or more " \
   "contributor license agreements.  See the NOTICE file distributed with " \
   "this work for additional information regarding copyright ownership.  " \
   "The ASF licenses this file to You under the Apache License, Version 2.0 " \
   "(the ""License""); you may not use this file except in compliance with " \
   "http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n" \
   "Unless required by applicable law or agreed to in writing, software " \
   "distributed under the License is distributed on an ""AS IS"" BASIS, " \
   "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  " \
   "See the License for the specific language governing permissions and " \
   "limitations under the License."
+#endif

Afterwards, I was still getting a couple of warnings (RC4011). The cause of these warnings is even more ridiculous. It turns out that the Preprocessor Definitions set for a resource are not honored by the Resource View. As a result, APR_VERSION_ONLY appears not to be defined. The following change in libapr.rc fixed the problem.

+#ifdef APSTUDIO_INVOKED
+#define APR_VERSION_ONLY
+#endif
 #include "apr_version.h"

I'd even define APR_VERSION_ONLY unconditionally before including apr_version.h.

The same issues apply to libaprutil.rc.

Hope this helps,

Arsen