There were a few compile errors when trying to build gambit with the visual studio c++ compiler.  After these changes gambit seems to work fine.  Marc, maybe you can include them in the source.  Thanks.

---

diff -rup ..\..\..\..\..\temp\gambc-v4_6_0-devel\lib\os_files.c .\os_files.c
--- ..\..\..\..\..\temp\gambc-v4_6_0-devel\lib\os_files.c    Thu Jan 07 12:58:49 2010
+++ .\os_files.c    Sat Apr 03 00:03:18 2010
@@ -545,7 +545,7 @@ ___SCMOBJ ___os_path_gambcdir ___PVOID
 #ifdef _UNICODE
           _tcscpy (gambcdir, temp);
 #else
-          mbstowcs (gambcdir, temp, cch);
+          mbstowcs ((wchar_t *)gambcdir, temp, cch);
               gambcdir[cch] = '\0';
 #endif
           ___setup_params.gambcdir = gambcdir;
diff -rup ..\..\..\..\..\temp\gambc-v4_6_0-devel\lib\os_tty.c .\os_tty.c
--- ..\..\..\..\..\temp\gambc-v4_6_0-devel\lib\os_tty.c    Thu Jan 07 12:58:49 2010
+++ .\os_tty.c    Sat Apr 03 00:09:42 2010
@@ -3391,7 +3391,7 @@ ___U8 *text_arg;)
           {
             if (text_arg != NULL)
               {
-                SetWindowTextA (cons_wind, text_arg); /* ignore error */
+                SetWindowTextA (cons_wind, (LPCSTR)text_arg); /* ignore error */
               }
             else
               {
@@ -4491,7 +4491,7 @@ int len;)
 
           if (global_copy != NULL)
             {
-              ___U16 *locked_copy = GlobalLock (global_copy);
+              ___U16 *locked_copy = (___U16 *)GlobalLock (global_copy);
 
               if (locked_copy == NULL)
                 GlobalFree (global_copy);
@@ -4576,7 +4576,7 @@ ___device_tty *self;)
 
           if (global_copy != NULL)
             {
-              ___U16 *locked_copy = GlobalLock (global_copy);
+              ___U16 *locked_copy = (___U16 *)GlobalLock (global_copy);
 
               if (locked_copy != NULL)
                 {




On Thu, Apr 1, 2010 at 4:52 PM, Kartik Saranathan <ksaranat@gmail.com> wrote:
Hello all.

I'd like to compile and link gambit generated code with C++ code.  Looking
at previous posts on this mailing list the way to do it is to build gambit
with a c++ compiler.  I have Visual Studio 2008.  I tried adding the options
-TP (compile as C++ code) and -EHsc (enable c++ exceptions) to 
misc/vc2008.bat but the code does not compile without modifications (there
is some type casting from void* to non-void* which require explicit cast in c++).

What is the proper way to build gambit using the Visual Studio 2008 c++
compiler?  On unix systems I can pass --enable-cplusplus option to
configure.  Can I setup mingw or cygwin to do the same on Windows?  If so
how do I do this?

Also the windows binary distribution of Gambit 4.6.0 opens a new window when
running "gsc -exe test.scm".  Once the compile finishes the window is closed
immediately making it hard to read the output.  I notice when I compile
gambit using vc2008.bat it does not open a new window.  It would be better
if the official binary distribution did this as well.  I notice that for
binaries that I build using gsc if I define _WINDOWS it opens a new console
window.  Maybe the official windows binary distribution compiles gsc with
_WINDOWS defined?

Thank you

- Kartik