Skip to content

Commit cec46e5

Browse files
vylsazrexim
authored andcommitted
Improve tcc support
1 parent 8d85e7f commit cec46e5

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

nob.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@
161161
# define _WINCON_
162162
# include <windows.h>
163163
# include <direct.h>
164+
# include <io.h>
164165
# include <shellapi.h>
165166
#else
166167
# ifdef __APPLE__
@@ -659,6 +660,8 @@ NOBDEF char *nob_temp_running_executable_path(void);
659660
# define nob_cc(cmd) nob_cmd_append(cmd, "clang")
660661
# elif defined(_MSC_VER)
661662
# define nob_cc(cmd) nob_cmd_append(cmd, "cl.exe")
663+
# elif defined(__TINYC__)
664+
# define nob_cc(cmd) nob_cmd_append(cmd, "tcc")
662665
# endif
663666
# else
664667
# define nob_cc(cmd) nob_cmd_append(cmd, "cc")
@@ -699,6 +702,8 @@ NOBDEF char *nob_temp_running_executable_path(void);
699702
# define NOB_REBUILD_URSELF(binary_path, source_path) "clang", "-o", binary_path, source_path
700703
# elif defined(_MSC_VER)
701704
# define NOB_REBUILD_URSELF(binary_path, source_path) "cl.exe", nob_temp_sprintf("/Fe:%s", (binary_path)), source_path
705+
# elif defined(__TINYC__)
706+
# define NOB_REBUILD_URSELF(binary_path, source_path) "tcc", "-o", binary_path, source_path
702707
# endif
703708
# else
704709
# define NOB_REBUILD_URSELF(binary_path, source_path) "cc", "-o", binary_path, source_path
@@ -2083,7 +2088,7 @@ NOBDEF bool nob_read_entire_file(const char *path, Nob_String_Builder *sb)
20832088
#ifndef _WIN32
20842089
m = ftell(f);
20852090
#else
2086-
m = _ftelli64(f);
2091+
m = _telli64(_fileno(f));
20872092
#endif
20882093
if (m < 0) nob_return_defer(false);
20892094
if (fseek(f, 0, SEEK_SET) < 0) nob_return_defer(false);
@@ -2543,6 +2548,8 @@ NOBDEF char *nob_temp_running_executable_path(void)
25432548
25442549
2.0.1 ( ) Fix Walk_Entry naming (by @Sinha-Ujjawal)
25452550
Using single String Builder in nob__walk_dir_opt_impl (by @Sinha-Ujjawal)
2551+
Add tcc to nob_cc_*() and NOB_REBUILD_URSELF() macros (by @vylsaz)
2552+
Fix building nob_read_entire_file() with tcc on windows (by @vylsaz)
25462553
2.0.0 (2026-01-06) Remove minirent.h (by @rexim)
25472554
BACKWARD INCOMPATIBLE CHANGE!!! If you were using minirent.h from this library
25482555
just use it directly from https://github.com/tsoding/minirent

0 commit comments

Comments
 (0)