diff --git a/memfile.c b/memfile.cpp similarity index 77% rename from memfile.c rename to memfile.cpp index 68b7d7db..9519e5d7 100644 --- a/memfile.c +++ b/memfile.cpp @@ -2,7 +2,10 @@ #include #include #include -#include "memfile.h" + +extern "C" { + #include "memfile.h" +} #define INCREMENT 131072 @@ -11,12 +14,12 @@ struct memfile *memfile_open(int fd) { return NULL; } - char *map = mmap(NULL, INCREMENT, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); + char *map = (char *) mmap(NULL, INCREMENT, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); if (map == MAP_FAILED) { return NULL; } - struct memfile *mf = malloc(sizeof(struct memfile)); + struct memfile *mf = (struct memfile *) malloc(sizeof(struct memfile)); if (mf == NULL) { munmap(map, INCREMENT); return NULL; @@ -58,7 +61,7 @@ int memfile_write(struct memfile *file, void *s, long long len) { return -1; } - file->map = mmap(NULL, file->len, PROT_READ | PROT_WRITE, MAP_SHARED, file->fd, 0); + file->map = (char *) mmap(NULL, file->len, PROT_READ | PROT_WRITE, MAP_SHARED, file->fd, 0); if (file->map == MAP_FAILED) { return -1; }