Pedro Alves wrote:
Paul Sokolovsky wrote:

  But still, liboldname-ce would rather not export non-existent
functions.

Oh, you are right, that was indeed a big thinko on my part.
There is indeed a thin write implementation in libmingwex.a, but you are right in that liboldname should not
export those functions, since it maps the functions into coredll.dll.

And here is the patch:
No time to test this at the moment, but I am still applying, as it can't be worse than it is now.

I am adding both underscored and non underscored versions of these functions, to be more source compatible with the desktop version of MinGW. Maybe we should split the functions into their own files so less is pulled in by the linker, or use attribute alias (implemented, but never tested :) ). I'll leave that for later on. First correctness.

Cheers,
Pedro Alves

---
src/mingw/ChangeLog.mingw32ce

2006-11-16  Pedro Alves  <[EMAIL PROTECTED]>

   * moldname.def.in (open, lseek, read, write): Don't export on
   coredll.dll.
   * mingwex/wince/open.c (vopen): Rename from _open, and made
   static.
   * mingwex/wince/open.c (open, _open): New functions.
   * mingwex/wince/lseek.c (lseek): New function, implementing an
   alias for the underscored version.
   * mingwex/wince/fdopen.c (fdopen): Likewise.
   * mingwex/wince/read.c (read): Likewise.
   * mingwex/wince/write.c (write): Likewise.

Index: moldname.def.in
===================================================================
--- moldname.def.in     (revision 786)
+++ moldname.def.in     (working copy)
@@ -29,9 +29,7 @@
 chdir
 chmod
 chsize
-#endif /* __COREDLL__ */
 close
-#ifndef __COREDLL__
 creat
 cwait
 #endif /* __COREDLL__ */
@@ -85,25 +83,21 @@
 kbhit
 lfind
 lsearch
-#endif /* __COREDLL__ */
 lseek
+#endif /* __COREDLL__ */
 ltoa
 memccpy
 memicmp
 #ifndef __COREDLL__
 mkdir
 mktemp
-#endif /* __COREDLL__ */
 open
-#ifndef __COREDLL__
 pclose
 popen
 putch
 putenv
 putw
-#endif /* __COREDLL__ */
 read
-#ifndef __COREDLL__
 rmdir
 rmtmp
 searchenv
@@ -166,7 +160,9 @@
 #if  (__MSVCRT__)
 wpopen
 #endif
+#ifndef __COREDLL__
 write
+#endif
 ; non-ANSI functions declared in math.h
 j0
 j1
Index: mingwex/wince/open.c
===================================================================
--- mingwex/wince/open.c        (revision 786)
+++ mingwex/wince/open.c        (working copy)
@@ -2,8 +2,8 @@
 #include <unistd.h>
 #include <fcntl.h>
 
-int
-_open (const char *path, int oflag, ...)
+static int
+vopen (const char *path, int oflag, va_list ap)
 {
   wchar_t wpath[MAX_PATH];
   DWORD fileaccess;
@@ -72,3 +72,25 @@
 
   return (int) hnd;
 }
+
+int
+_open (const char *path, int oflag, ...)
+{
+  va_list ap;
+  int ret;
+  va_start (ap, oflag);
+  ret = vopen (path, oflag, ap);
+  va_end (ap);
+  return ret;
+}
+
+int
+open (const char *path, int oflag, ...)
+{
+  va_list ap;
+  int ret;
+  va_start (ap, oflag);
+  ret = vopen (path, oflag, ap);
+  va_end (ap);
+  return ret;
+}
Index: mingwex/wince/lseek.c
===================================================================
--- mingwex/wince/lseek.c       (revision 789)
+++ mingwex/wince/lseek.c       (working copy)
@@ -17,8 +17,14 @@
       mode = FILE_END;
       break;
     default:
-     /* Specify an invalid mode so SetFilePointer catches it.  */
+      /* Specify an invalid mode so SetFilePointer catches it.  */
       mode = (DWORD)-1;
     }
   return (long) SetFilePointer ((HANDLE) fildes, offset, NULL, mode);
 }
+
+long
+lseek (int fildes, long offset, int whence)
+{
+  return _lseek (fildes, offset, whence);
+}
Index: mingwex/wince/close.c
===================================================================
--- mingwex/wince/close.c       (revision 787)
+++ mingwex/wince/close.c       (working copy)
@@ -8,3 +8,9 @@
     return 0;
   return -1;
 }
+
+int
+close (int fildes)
+{
+  return _close (fildes);
+}
Index: mingwex/wince/fdopen.c
===================================================================
--- mingwex/wince/fdopen.c      (revision 786)
+++ mingwex/wince/fdopen.c      (working copy)
@@ -15,3 +15,9 @@
   f = _wfdopen (fildes, wmode);
   return f;
 }
+
+FILE *
+fdopen (int fildes, const char *mode)
+{
+  return _fdopen (fildes, mode);
+}
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Cegcc-devel mailing list
Cegcc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cegcc-devel

Reply via email to