[m-dev.] Building with MSVC
Sergey Khorev
sergey.khorev at gmail.com
Tue Dec 11 17:33:32 AEDT 2007
Hi,
I've been compiling last few ROTDs with Visual Studio 2005 and would
like to put a couple of notes on this:
1) New versions of nmake have default rule for .cc files which breaks
build of Boehm GC. I suggest a simple patch to fix that
*** boehm_gc/NT_MAKEFILE.bak Sun Feb 18 11:01:55 2007
--- boehm_gc/NT_MAKEFILE Sat Dec 8 19:16:35 2007
***************
*** 6,11 ****
--- 6,14 ----
CPU=\$(MY_CPU)
!include <ntwin32.mak>
+ .SUFFIXES:
+ .SUFFIXES: .obj .c .cpp .cxx
+
OBJS= alloc.obj reclaim.obj allchblk.obj misc.obj mach_dep.obj
os_dep.obj mark_rts.obj headers.obj mark.obj obj_map.obj blacklst.obj
finalize.obj new_hblk.obj dbg_mlc.obj malloc.obj stubborn.obj
dyn_load.obj typd_mlc.obj ptr_chck.obj gc_cpp.obj mallocx.obj msvc_dbg.obj
all: gctest.exe cord\de.exe test_cpp.exe
2) rotd-2007-12-09 introduced unportable code in
runtime/mercury_wrapper.c (see below)
Perhaps /proc should be used in Unix environment only.
Also in MSVC world snprintf is known as _snprintf so there should be
something like
#if defined(MR_HAVE__SNPRINTF) && ! defined(MR_HAVE_SNPRINTF)
#define snprintf _snprintf
#endif
#ifdef MR_HAVE_SYS_STAT_H
if (MR_mem_usage_report_prefix != NULL) {
struct stat statbuf;
char filename_buf[MAX_MEM_USAGE_REPORT_CMD_SIZE];
char cmd_buf[MAX_MEM_USAGE_REPORT_CMD_SIZE];
int i;
for (i = 1; i < MAX_MEM_USAGE_REPORT_ATTEMPTS; i++) {
snprintf(filename_buf, MAX_MEM_USAGE_REPORT_CMD_SIZE,
"%s%02d", MR_mem_usage_report_prefix, i);
if (stat(filename_buf, &statbuf) == 0) {
/* Filename_buf exists; try next name. */
continue;
}
snprintf(cmd_buf, MAX_MEM_USAGE_REPORT_CMD_SIZE,
"cp /proc/%d/status %s", getpid(), filename_buf);
system(cmd_buf);
break;
}
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at csse.unimelb.edu.au
Administrative Queries: owner-mercury-developers at csse.unimelb.edu.au
Subscriptions: mercury-developers-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the developers
mailing list