Bug 692349 - utf8-Ghostscript: 'wmemset()' not found when compiling with VS2003 or VS6.
Summary: utf8-Ghostscript: 'wmemset()' not found when compiling with VS2003 or VS6.
Status: RESOLVED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: General (show other bugs)
Version: master
Hardware: PC Windows XP
: P4 enhancement
Assignee: Robin Watts
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-16 19:09 UTC by SaGS
Modified: 2011-07-30 16:51 UTC (History)
2 users (show)

See Also:
Customer:
Word Size: ---


Attachments
Suggested patch. (1.73 KB, patch)
2011-07-16 19:10 UTC, SaGS
Details | Diff
Implement wmemset() (1.30 KB, patch)
2011-07-29 22:40 UTC, Alex Cherepanov
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description SaGS 2011-07-16 19:09:08 UTC
Cannot build Ghostscript on Windows with Visual Studio .NET 2003 
(and with Visual Studio 6, I think), because at link time the symbol 
"_wmemset" is not defined. Cause: please see comment #1 below.
Comment 1 SaGS 2011-07-16 19:10:46 UTC
Created attachment 7680 [details]
Suggested patch.

Bug #692349: utf8-Ghostscript - 'wmemset()' not found when compiling with VS2003 or VS6.

'wmemset()' is documented for both Visual Studio 6.0 and .NET 2003, but
a bug in the shipped "wctype.h" makes it available only for C++ programs.
As this is an inline function, it's not found in the libs.

This function was used only in 2 places. In one, it is replaced by a loop.
For the other, we now allocate an extra blank line so the 'memmove()'
that scrolls the buffer will also clear the last line by copying the extra
blanks; the second 'wmemset()' isn't necessary anymore.
Comment 2 Alex Cherepanov 2011-07-16 22:36:40 UTC
Current revision compiles on VS2003, 32-bit just fine.
I've tested debug and release builds.
Comment 3 SaGS 2011-07-17 04:39:58 UTC
> Current revision compiles on VS2003, 32-bit just fine.

If I build using VS2003 WITH the utf8 stuff in, I get

    dwtext.obj : error LNK2019: unresolved external symbol _wmemset 
    referenced in function _text_create

My local 'master' was behind the server's 'master' (GIT GUI didn't do what I *thought* it did), so I did not have the change that removes the utf8 code when building on VS2003 and VS6. But sacrifice a feature for a small and not so useful CRT call?

I'm changing this to an enhancement. And if you agree with my change, also please remove the /DWINDOWS_NO_UNICODE from msvc.mak (the "CFLAGS=" line #867 at this time).
Comment 4 Henry Stiles 2011-07-29 21:11:41 UTC
Assign to the author of the relevant changes.
Comment 5 Alex Cherepanov 2011-07-29 22:40:06 UTC
Created attachment 7727 [details]
Implement wmemset()

Many thanks to SaGS for analyzing the problem.
I think, that my patch, which implements wmemset(), is easier to
understand.

BTW, current version defines /DWINDOWS_NO_UNICODE by default.
Comment 6 Robin Watts 2011-07-30 16:51:05 UTC
Fixed in:

commit 951dee021a45d501e159a3b08624979604e906f5
Author: Robin Watts <Robin.Watts@artifex.com>
Date:   Sat Jul 30 17:48:14 2011 +0100

    Fix bug 692349: UNICODE build of gs not available with VS2003 or VS6.

    Apply a slightly tweaked version of alexchers patch to define wmemset
    when it's not provided by the headers.

    No cluster differences expected.


Thanks guys.