Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make libtest work with MSVC8

  • Loading branch information...
commit 274b869b6b1b255326a87e4fa8f2a2b9b21acafb 1 parent 081b37e
@luismbo luismbo authored
Showing with 12 additions and 5 deletions.
  1. +2 −2 tests/compile.bat
  2. +10 −3 tests/libtest.c
View
4 tests/compile.bat
@@ -2,8 +2,8 @@ rem
rem script for compiling the test lib with the free MSVC++ toolkit.
rem
-cl /ML /LD -D_MT /DWIN32=1 libtest.c
+cl /LD /DWIN32=1 /Tc libtest.c
del libtest.obj libtest.exp
-cl /ML /LD -D_MT /DWIN32=1 libtest2.c
+cl /LD /DWIN32=1 /Tc libtest2.c
del libtest2.obj libtest2.exp
View
13 tests/libtest.c
@@ -37,7 +37,14 @@
#include <stdlib.h>
#include <math.h>
#include <float.h>
+
+/* MSVC doesn't have stdint.h and uses a different syntax for stdcall */
+#ifndef _MSC_VER
#include <stdint.h>
+#define STDCALL __attribute__((stdcall))
+#else
+#define STDCALL __stdcall
+#endif
/*
* Some functions that aren't available on WIN32
@@ -820,8 +827,8 @@ DLLEXPORT int ns_var = 1;
* DEFCFUN.STDCALL.1
*/
-DLLEXPORT __attribute__((stdcall))
-int stdcall_fun(int a, int b, int c)
+DLLEXPORT
+int STDCALL stdcall_fun(int a, int b, int c)
{
return a + b + c;
}
@@ -831,7 +838,7 @@ int stdcall_fun(int a, int b, int c)
*/
DLLEXPORT
-int call_stdcall_fun(int __attribute__((stdcall)) (*f)(int, int, int))
+int call_stdcall_fun(int (STDCALL *f)(int, int, int))
{
int a = 42;
f(1, 2, 3);
Please sign in to comment.
Something went wrong with that request. Please try again.