Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement for shared library build #10

Merged
merged 1 commit into from
Nov 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions mman-win32.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
QT -= core gui

TARGET = mman
TEMPLATE = lib
# CONFIG += staticlib

DEFINES += MMAN_LIBRARY

HEADERS += \
mman.h

SOURCES += \
mman.c
18 changes: 12 additions & 6 deletions mman.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
#include <_mingw.h>
#endif

#if defined(MMAN_LIBRARY)
#define MMANSHARED_EXPORT __declspec(dllexport)
#else
#define MMANSHARED_EXPORT __declspec(dllimport)
#endif

/* Determine offset type */
#include <stdint.h>
#if defined(_WIN64)
Expand Down Expand Up @@ -49,12 +55,12 @@ extern "C" {
#define MS_SYNC 2
#define MS_INVALIDATE 4

void* mmap(void *addr, size_t len, int prot, int flags, int fildes, OffsetType off);
int munmap(void *addr, size_t len);
int _mprotect(void *addr, size_t len, int prot);
int msync(void *addr, size_t len, int flags);
int mlock(const void *addr, size_t len);
int munlock(const void *addr, size_t len);
MMANSHARED_EXPORT void* mmap(void *addr, size_t len, int prot, int flags, int fildes, OffsetType off);
MMANSHARED_EXPORT int munmap(void *addr, size_t len);
MMANSHARED_EXPORT int _mprotect(void *addr, size_t len, int prot);
MMANSHARED_EXPORT int msync(void *addr, size_t len, int flags);
MMANSHARED_EXPORT int mlock(const void *addr, size_t len);
MMANSHARED_EXPORT int munlock(const void *addr, size_t len);

#ifdef __cplusplus
}
Expand Down