[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    RFC: MSVCRT
From:       David Elliott <dfe () infinite-internet ! net>
Date:       2000-10-31 5:55:37
[Download RAW message or body]

Hi,

I have started implementing MSVCRT for Wine and specifically for use with
Winelib.

Attached are three files, msvcrt.diff, msvcrt_lazy.diff, and msvcrt.tar.gz

The msvcrt.diff contains the changes you will need to make to your wine
source tree (against the CVS of about 20 minutes ago).

The msvcrt_lazy.diff contains the diff you will need if you are too lazy to
run autoconf and tools/make_debug (but this could bite you in the ass, so if
you have autoconf on your system, you should use it).  The diff to configure
has some extra stuff in it because apparently my autoconf is a bit different
from the one Alexandre uses.

The msvcrt.tar.gz contains the new files for msvcrt and a winelib
application (in programs/) that will test the msvcrt implementation.

Somehow the CVS directory got into dlls/msvcrt, dunno how cause I don't
remember it being in CVS.  Maybe this is a CVS "feature".

The libwinemsvcrt.so is an idea I had to resolve the issue of symbol
naming.  A winelib program wishing to use MSVCRT for its libc links against
winemsvcrt.  The header files are designed with #defines so that when a
program uses for example exit(0) it translates to MSVCRT_exit(0).  Thus the
issue of naming is dealt with during the compile as opposed to hacking link
defines.  The drawback to this approach is that importing of other DLLs from
a DLL is somewhat broken in that WINEMSVCRT does not correctly load or
initialize the MSVCRT library since the winebuild generated code does not do
this correctly.  Eventually this should be done correctly and
WINEMSVCRT will even load a native MSVCRT.

Another possible implementation of the winemsvcrt library is commented out
in the dlls/msvcrt/winemsvcrt/Makefile.in file.  It creates libwinemsvcrt by
appending MSVCRT_ to the names in the msvcrt.spec and reusing the .o files
used to create msvcrt.  The drawback to this approach is that it duplicates
some binary code and will not allow the native msvcrt to be used.  It also
won't allow you to use a native msvcrt for winelib.  This was my original
way of doing it, provided only for reference.

I personally prefer obfuscating the function names over fooling with
linkorder, but I would like other people opinions about how to handle the
conflict with real libc names.  For what it's worth, I believe MinGW32 uses
my system of obfuscating names.

Another advantage to my approach is that different sourcefiles of the same
program can use different headers and thus use both the real libc functions
and MSVCRT functions in the same program.  It also makes the headers look a
lot cleaner than they would if the function names had to be different for
internal wine building and winelib building.

In the programs/msvcrttest directory there is a stdarg.h from gcc 2.96
included.  This is only because I haven't yet provided a stdarg.h and one of
the wine headers needs some definitions from it.

There is also an empty string.h because it is included in include/winnt.h
(presumably as a courtesy include because it doesn't seem to use it).

I really want input from everyone on this, especially anyone at Codeweavers
working on this or thinking about it.  I know Francois had expressed some
interest.

Also, I would like some people more familiar with legal issues to let me
know if it would be okay to look at MSes provided source to MSVCRT.  I am
thinking no, and thus I have not and will not look at it.  I think I have it
on my MSVS CD here, and it would help a lot with issues like binary
compatibility, but I'd rather have a slightly broken but legal MSVCRT than
one that could get me and others into legal trouble.  That and if I happen
to implement a function exactly like MS (just by coincidence, for example,
I would imagine malloc and free have a similar implementation) I don't want
the issue coming up that I have seen the source and might have directly
copied it.

Have a good day!
-Dave

["msvcrt.diff" (text/plain)]

? dlls/msvcrt
? include/mixedcrt
? include/msvcrt
? programs/msvcrttest
Index: Make.rules.in
===================================================================
RCS file: /home/wine/wine/Make.rules.in,v
retrieving revision 1.69
diff -u -r1.69 Make.rules.in
--- Make.rules.in	2000/10/31 00:20:51	1.69
+++ Make.rules.in	2000/10/31 04:50:40
@@ -121,6 +121,8 @@
 	msacm.drv \
 	msacm32 \
 	msnet32 \
+	msvcrt \
+	winemsvcrt \
 	msvfw32 \
 	odbc32 \
 	ole32 \
Index: configure.in
===================================================================
RCS file: /home/wine/wine/configure.in,v
retrieving revision 1.155
diff -u -r1.155 configure.in
--- configure.in	2000/10/23 21:32:05	1.155
+++ configure.in	2000/10/31 04:50:56
@@ -1065,6 +1065,8 @@
 dlls/mpr/Makefile
 dlls/msacm/Makefile
 dlls/msnet32/Makefile
+dlls/msvcrt/Makefile
+dlls/msvcrt/winemsvcrt/Makefile
 dlls/msvideo/Makefile
 dlls/ntdll/Makefile
 dlls/odbc32/Makefile
@@ -1135,6 +1137,7 @@
 programs/clock/Makefile
 programs/cmdlgtst/Makefile
 programs/control/Makefile
+programs/msvcrttest/Makefile
 programs/notepad/Makefile
 programs/osversioncheck/Makefile
 programs/progman/Makefile
Index: dlls/Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/Makefile.in,v
retrieving revision 1.71
diff -u -r1.71 Makefile.in
--- dlls/Makefile.in	2000/10/31 00:20:51	1.71
+++ dlls/Makefile.in	2000/10/31 04:50:58
@@ -32,6 +32,8 @@
 	mpr/libmpr.@LIBEXT@ \
 	msacm/libmsacm32.@LIBEXT@ \
 	msnet32/libmsnet32.@LIBEXT@ \
+	msvcrt/libmsvcrt.@LIBEXT@ \
+	msvcrt/winemsvcrt/libwinemsvcrt.@LIBEXT@ \
 	msvideo/libmsvfw32.@LIBEXT@ \
 	ntdll/libntdll.@LIBEXT@ \
 	odbc32/libodbc32.@LIBEXT@ \
@@ -141,6 +143,7 @@
 	mpr \
 	msacm \
 	msnet32 \
+	msvcrt \
 	msvideo \
 	ntdll \
 	odbc32 \
@@ -268,6 +271,12 @@
 libmsnet32.@LIBEXT@: msnet32/libmsnet32.@LIBEXT@
 	$(RM) $@ && $(LN_S) msnet32/libmsnet32.@LIBEXT@ $@
 
+libmsvcrt.@LIBEXT@: msvcrt/libmsvcrt.@LIBEXT@
+	$(RM) $@ && $(LN_S) msvcrt/libmsvcrt.@LIBEXT@ $@
+
+libwinemsvcrt.@LIBEXT@: msvcrt/winemsvcrt/libwinemsvcrt.@LIBEXT@
+	$(RM) $@ && $(LN_S) msvcrt/winemsvcrt/libwinemsvcrt.@LIBEXT@ $@
+
 libmsvfw32.@LIBEXT@ libmsvideo.@LIBEXT@: msvideo/libmsvfw32.@LIBEXT@
 	$(RM) $@ && $(LN_S) msvideo/libmsvfw32.@LIBEXT@ $@
 
@@ -396,6 +405,8 @@
 lzexpand/liblz32.so: libkernel32.so
 mpr/libmpr.so: libkernel32.so
 msacm/libmsacm32.so: libwinmm.so libuser32.so libkernel32.so
+msvcrt/libmsvcrt.so: libkernel32.so
+msvcrt/winemsvcrt/libwinemsvcrt.so: libmsvcrt.so
 msnet32/libmsnet32.so: libntdll.so
 msvideo/libmsvfw32.so: libwinmm.so libuser32.so libgdi32.so libkernel32.so
 odbc32/libodbc32.so: libntdll.so
Index: include/Makefile.in
===================================================================
RCS file: /home/wine/wine/include/Makefile.in,v
retrieving revision 1.12
diff -u -r1.12 Makefile.in
--- include/Makefile.in	2000/10/13 23:16:46	1.12
+++ include/Makefile.in	2000/10/31 04:51:01
@@ -38,6 +38,10 @@
 	mmreg.h \
 	mmsystem.h \
 	msacm.h \
+	msvcrt/math.h \
+	msvcrt/stdlib.h \
+	msvcrt/errno.h \
+	msvcrt/process.h \
 	ntsecapi.h \
 	oaidl.h \
 	objbase.h \
@@ -138,12 +142,13 @@
 	wtypes.h \
 	zmouse.h
 
-EXTRASUBDIRS = bitmaps wine
+EXTRASUBDIRS = bitmaps msvcrt wine
 
 @MAKE_RULES@
 
 install::
 	[ -d $(includedir) ] || $(MKDIR) $(includedir)
+	[ -d $(includedir)/msvcrt ] || $(MKDIR) $(includedir)/msvcrt
 	[ -d $(includedir)/wine ] || $(MKDIR) $(includedir)/wine
 	for f in $(INSTALLED_INCLUDES); do $(INSTALL_DATA) $(SRCDIR)/$$f $(includedir)/$$f; done
 
Index: programs/Makefile.in
===================================================================
RCS file: /home/wine/wine/programs/Makefile.in,v
retrieving revision 1.10
diff -u -r1.10 Makefile.in
--- programs/Makefile.in	2000/10/31 00:22:42	1.10
+++ programs/Makefile.in	2000/10/31 04:51:07
@@ -9,6 +9,7 @@
 	clock \
 	cmdlgtst \
 	control \
+	msvcrttest \
 	notepad \
 	osversioncheck \
 	progman \

["msvcrt_lazy.diff" (text/plain)]

Index: configure
===================================================================
RCS file: /home/wine/wine/configure,v
retrieving revision 1.155
diff -u -r1.155 configure
--- configure	2000/10/23 21:32:05	1.155
+++ configure	2000/10/31 04:50:54
@@ -5139,7 +5139,7 @@
 #include "confdefs.h"
 #include <alloca.h>
 int main() {
-void *p = alloca(2 * sizeof(int));
+char *p = alloca(2 * sizeof(int));
 ; return 0; }
 EOF
 if { (eval echo configure:5146: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test \
-s conftest${ac_exeext}; then @@ -5603,7 +5603,7 @@
 int main() {
 
 /* Ultrix mips cc rejects this.  */
-typedef int charset[2]; const charset x = {0,0};
+typedef int charset[2]; const charset x;
 /* SunOS 4.1.1 cc rejects this.  */
 char const *const *ccp;
 char **p;
@@ -5678,7 +5678,7 @@
 #include "confdefs.h"
 
 int main() {
-} int $ac_kw foo() {
+} $ac_kw foo() {
 ; return 0; }
 EOF
 if { (eval echo configure:5685: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; \
then @@ -6495,6 +6495,8 @@
 dlls/mpr/Makefile
 dlls/msacm/Makefile
 dlls/msnet32/Makefile
+dlls/msvcrt/Makefile
+dlls/msvcrt/winemsvcrt/Makefile
 dlls/msvideo/Makefile
 dlls/ntdll/Makefile
 dlls/odbc32/Makefile
@@ -6565,6 +6567,7 @@
 programs/clock/Makefile
 programs/cmdlgtst/Makefile
 programs/control/Makefile
+programs/msvcrttest/Makefile
 programs/notepad/Makefile
 programs/osversioncheck/Makefile
 programs/progman/Makefile
@@ -6728,6 +6731,8 @@
 dlls/mpr/Makefile
 dlls/msacm/Makefile
 dlls/msnet32/Makefile
+dlls/msvcrt/Makefile
+dlls/msvcrt/winemsvcrt/Makefile
 dlls/msvideo/Makefile
 dlls/ntdll/Makefile
 dlls/odbc32/Makefile
@@ -6798,6 +6803,7 @@
 programs/clock/Makefile
 programs/cmdlgtst/Makefile
 programs/control/Makefile
+programs/msvcrttest/Makefile
 programs/notepad/Makefile
 programs/osversioncheck/Makefile
 programs/progman/Makefile
Index: include/debugdefs.h
===================================================================
RCS file: /home/wine/wine/include/debugdefs.h,v
retrieving revision 1.39
diff -u -r1.39 debugdefs.h
--- include/debugdefs.h	2000/07/08 18:27:03	1.39
+++ include/debugdefs.h	2000/10/31 04:51:02
@@ -98,6 +98,7 @@
 char dbch_mpr[] = "\003mpr";
 char dbch_msacm[] = "\003msacm";
 char dbch_msg[] = "\003msg";
+char dbch_msvcrt[] = "\003msvcrt";
 char dbch_msvideo[] = "\003msvideo";
 char dbch_nativefont[] = "\003nativefont";
 char dbch_nonclient[] = "\003nonclient";
@@ -173,7 +174,7 @@
 char dbch_x11[] = "\003x11";
 char dbch_x11drv[] = "\003x11drv";
 
-#define DEBUG_CHANNEL_COUNT 166
+#define DEBUG_CHANNEL_COUNT 167
 
 static char * const debug_channels[DEBUG_CHANNEL_COUNT] = {
     dbch_accel,
@@ -268,6 +269,7 @@
     dbch_mpr,
     dbch_msacm,
     dbch_msg,
+    dbch_msvcrt,
     dbch_msvideo,
     dbch_nativefont,
     dbch_nonclient,


["msvcrt.tar.gz" (application/x-gzip)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic