changeset 2958:84bd7e213e56 octave-forge

Fix compilation for MSVC and port to recent octave version
author goffioul
date Sun, 21 Jan 2007 21:15:52 +0000
parents 1d3ac2f96b85
children 610db3cb68da
files extra/Windows/src/Makefile extra/Windows/src/win32api.cc
diffstat 2 files changed, 19 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/extra/Windows/src/Makefile	Sun Jan 21 18:17:34 2007 +0000
+++ b/extra/Windows/src/Makefile	Sun Jan 21 21:15:52 2007 +0000
@@ -1,11 +1,15 @@
 sinclude ./Makeconf
 
-PROGS=grab.oct win32api.oct ../inst/BROWER.m ../inst/image.m
+PROGS=grab.oct win32api.oct # ../inst/BROWER.m ../inst/image.m
 
 ifeq (,$(findstring -cygwin,$(canonical_host_type)))
   ifeq (,$(findstring -mingw,$(canonical_host_type)))
+    ifeq (,$(findstring -msdosmsvc,$(canonical_host_type)))
 all:
 	@echo "Not building Windows Specific functions"
+    else
+all: $(PROGS)
+    endif
   else
 all: $(PROGS)
   endif
@@ -14,10 +18,10 @@
 endif
 
 grab.oct: grab.o grab_win32part.o
-	$(MKOCTFILE) -o $@ $^
+	$(MKOCTFILE) -o $@ $^ -luser32
 
 win32api.oct: win32api.o win32api_win32part.o
-	$(MKOCTFILE) -o $@ $^
+	$(MKOCTFILE) -o $@ $^ -luser32 -ladvapi32
 
 ../inst/%.m : %.m.in
 	if [ ! -d ../inst ]; then mkdir ../inst; fi
--- a/extra/Windows/src/win32api.cc	Sun Jan 21 18:17:34 2007 +0000
+++ b/extra/Windows/src/win32api.cc	Sun Jan 21 21:15:52 2007 +0000
@@ -31,6 +31,11 @@
 
 #include <octave/oct.h>
 
+DEFUN_DLD (win32api, args, , "")
+{
+    return octave_value();
+}
+
 DEFUN_DLD (win32_MessageBox, args, ,
            "rv= win32_MessageBox (...)\n"
            "\n"
@@ -140,9 +145,9 @@
         return retval;
     }
 
-    const char * key   = args(0).string_value().c_str();
-    const char * subkey= args(1).string_value().c_str();
-    const char * value = args(2).string_value().c_str();
+    char * key   = strdup(args(0).string_value().c_str());
+    char * subkey= strdup(args(1).string_value().c_str());
+    char * value = strdup(args(2).string_value().c_str());
 
     // call registry first time to get size and existance
     int buffer_sz=0;
@@ -162,5 +167,9 @@
         delete buffer;
     }
 
+    free(key);
+    free(subkey);
+    free(value);
+
     return retval;
 }