Skip to content

Commit

Permalink
fix foreign test for i3nt (#860)
Browse files Browse the repository at this point in the history
For some build environments, `_WIN32` is needed in "foreign3.c" (as in
other "foreign*.c" files) instead of `WIN32` without the leading
underscore. Also, simplify "mats/build.zuo" by using `_WIN32` in
"ftype.h".
  • Loading branch information
mflatt committed Aug 6, 2024
1 parent 2b1969a commit 6822651
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
3 changes: 0 additions & 3 deletions mats/build.zuo
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,6 @@
"cc")))
(cons "FTYPE_CFLAGS"
(build-shell (or (lookup 'CPPFLAGS) "")
(if (eq? 'windows (system-type))
"-DWIN32"
"")
(or (lookup 'mdinclude) "")
(or (lookup 'CFLAGS) "")
(or (lookup 'mdcflags) "")))
Expand Down
6 changes: 3 additions & 3 deletions mats/foreign3.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <stdio.h>
#include <stdlib.h>

#ifndef WIN32
#ifndef _WIN32
#include <string.h>
#endif

Expand Down Expand Up @@ -178,7 +178,7 @@ EXPORT char Srvtest_char(ptr code, ptr x1) {
return (*((char (*)(ptr))Sforeign_callable_entry_point(code)))(x1);
}

#ifdef WIN32
#ifdef _WIN32
EXPORT int __stdcall sum_stdcall(int a, int b) {
return a + b;
}
Expand Down Expand Up @@ -208,7 +208,7 @@ EXPORT com_instance_t *get_com_instance(void) {
com_instance.data = -31;
return &com_instance;
}
#endif /* WIN32 */
#endif /* _WIN32 */

/* foreign_callable example adapted from foreign.stex */
typedef void (*CB)(char);
Expand Down
2 changes: 1 addition & 1 deletion mats/ftype.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ typedef unsigned long long uint64_t;

#endif

#ifdef WIN32
#ifdef _WIN32
#define EXPORT extern __declspec (dllexport)
#else
#define EXPORT extern
Expand Down

0 comments on commit 6822651

Please sign in to comment.