From 4a4dbe027a082e546512b5ccb2999753651a9a28 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Fri, 26 Nov 2021 13:53:43 +0100 Subject: Add a wrapper for the main function on Windows A macro and forward declaration are added to compat.h that rename the main() function programs using compat.h into sqfs_tools_main. An actual main() function is added to libcompat.a, that uses the shell API to get the UTF-16 command line arguments, convert them to UTF-8 and call sqfs_tools_main. Signed-off-by: David Oberhollenzer --- include/compat.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') diff --git a/include/compat.h b/include/compat.h index e82f2ad..59133c9 100644 --- a/include/compat.h +++ b/include/compat.h @@ -227,4 +227,10 @@ WCHAR *path_to_windows(const char *input); int fnmatch(const char *, const char *, int); #endif +#if defined(_WIN32) || defined(__WINDOWS__) +#define main sqfs_tools_main + +extern int sqfs_tools_main(int argc, char **argv); +#endif + #endif /* COMPAT_H */ -- cgit v1.2.3