Rein in unintended external functions on Windows.

This commit is contained in:
Jean-Claude Beaudoin 2016-09-27 01:43:40 -04:00
parent 08335c1548
commit 889ee28ed5
4 changed files with 7 additions and 5 deletions

View File

@ -117,7 +117,7 @@ static void tcc_add_systemdir(TCCState *s)
#endif #endif
#ifndef CONFIG_TCC_STATIC #ifndef CONFIG_TCC_STATIC
void dlclose(void *p) static void dlclose(void *p)
{ {
FreeLibrary((HMODULE)p); FreeLibrary((HMODULE)p);
} }
@ -135,7 +135,7 @@ BOOL WINAPI DllMain (HINSTANCE hDll, DWORD dwReason, LPVOID lpReserved)
/********************************************************/ /********************************************************/
/* copy a string and truncate it. */ /* copy a string and truncate it. */
PUB_FUNC char *pstrcpy(char *buf, int buf_size, const char *s) ST_FUNC char *pstrcpy(char *buf, int buf_size, const char *s)
{ {
char *q, *q_end; char *q, *q_end;
int c; int c;

2
tcc.h
View File

@ -1167,7 +1167,7 @@ ST_DATA struct TCCState *tcc_state;
#define AFF_PREPROCESS 0x0004 /* preprocess file */ #define AFF_PREPROCESS 0x0004 /* preprocess file */
/* public functions currently used by the tcc main function */ /* public functions currently used by the tcc main function */
PUB_FUNC char *pstrcpy(char *buf, int buf_size, const char *s); ST_FUNC char *pstrcpy(char *buf, int buf_size, const char *s);
ST_FUNC char *pstrcat(char *buf, int buf_size, const char *s); ST_FUNC char *pstrcat(char *buf, int buf_size, const char *s);
ST_FUNC char *pstrncpy(char *out, const char *in, size_t num); ST_FUNC char *pstrncpy(char *out, const char *in, size_t num);
PUB_FUNC char *tcc_basename(const char *name); PUB_FUNC char *tcc_basename(const char *name);

View File

@ -58,6 +58,7 @@
#endif #endif
#if 0
#ifdef _WIN32 #ifdef _WIN32
void dbg_printf (const char *fmt, ...) void dbg_printf (const char *fmt, ...)
{ {
@ -70,6 +71,7 @@ void dbg_printf (const char *fmt, ...)
OutputDebugString(buffer); OutputDebugString(buffer);
} }
#endif #endif
#endif
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
#ifndef IMAGE_NT_SIGNATURE #ifndef IMAGE_NT_SIGNATURE

View File

@ -28,7 +28,7 @@
#include <io.h> #include <io.h>
#include <malloc.h> #include <malloc.h>
char *get_export_names(int fd); static char *get_export_names(int fd);
#define tcc_free free #define tcc_free free
#define tcc_realloc realloc #define tcc_realloc realloc
@ -169,7 +169,7 @@ int read_mem(int fd, unsigned offset, void *buffer, unsigned len)
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
#endif #endif
char *get_export_names(int fd) static char *get_export_names(int fd)
{ {
int l, i, n, n0; int l, i, n, n0;
char *p; char *p;