hostlib.h
Go to the documentation of this file.
1 /****
2  * hostlib.h
3  *
4  * Copyright 2019 mikee47 <mike@sillyhouse.net>
5  *
6  * This file is part of the Sming Framework Project
7  *
8  * This library is free software: you can redistribute it and/or modify it under the terms of the
9  * GNU General Public License as published by the Free Software Foundation, version 3 or later.
10  *
11  * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
12  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13  * See the GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along with SHEM.
16  * If not, see <https://www.gnu.org/licenses/>.
17  *
18  ****/
19 
20 #pragma once
21 
22 // Required for sleep(), probably others
23 #undef _POSIX_C_SOURCE
24 #define _POSIX_C_SOURCE 200112L
25 
26 #ifdef __WIN32
27 // Prevent early inclusion of winsock.h
28 #include <winsock2.h>
29 #endif
30 
31 #include <fcntl.h>
32 #include <limits.h>
33 #include <stdint.h>
34 #include <stdbool.h>
35 #include <stddef.h>
36 #include <unistd.h>
37 
38 #ifndef ARRAY_SIZE
39 #define ARRAY_SIZE(x) (int)(sizeof(x) / sizeof((x)[0]))
40 #endif
41 
42 // Used for parameterised token pasting
43 #ifndef JOIN
44 #define JOIN_AGAIN(_a, _b) _a##_b
45 #define JOIN(_a, _b) JOIN_AGAIN(_a, _b)
46 #endif
47 
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51 
52 int msleep(unsigned ms);
53 
60 size_t getHostAppDir(char* path, size_t bufSize);
61 
62 #ifdef __cplusplus
63 }
64 #endif
size_t getHostAppDir(char *path, size_t bufSize)
Get directory where application is executing from.
int msleep(unsigned ms)