Subject: gnuwin32 & mmap
From: [email-masked] ("Patrick T. Hurley")

22 Feb 1997 08:41:57 -0800
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Original-To: [email-masked] (gwin)
X-Mailer: ELM [version 2.4.25 PGP3A]
Original-Sender: [email-masked]

I see mmap in the header files, but when I try to use
it in a program (I am trying to port mSQL), I get errors.

mSQL comes with a simple prog for testing mmap,
if I just:
$ gcc mmap.c
I get:
G:\TEMP/cc0010201.o(.text+0xbe):mmap.c: undefined reference to `mmap'
G:\TEMP/cc0010201.o(.text+0xf6):mmap.c: undefined reference to `munmap'

from the program (which comes with mSQL):

#include <stdio.h>
#include <sys/types.h>
#include <fcntl.h>
#include <sys/mman.h>

#define PATH    "/tmp/MmAp-TeSt"

main()
{
        int     fd,
                res;
        static   char   text[] = "Test Data";
        caddr_t cp;

        fd = open(PATH,O_CREAT|O_RDWR|O_TRUNC);
        if (fd < 0)
        {
                fprintf(stderr,"mmap test : couldn't create tmp file!\n\n");
                exit(1);
        }
        write(fd,text,strlen(text));
        cp = mmap(NULL,strlen(text), PROT_READ|PROT_WRITE, MAP_SHARED, fd,0);
        if (cp == (caddr_t) -1)
        {
                res = 1;
        }
        else
        {
                res=0;
                munmap(cp,strlen(text));
        }
        close(fd);
        unlink(PATH);
        exit(res);
}

tia pth
-
For help on using this list, send a message to
"[email-masked]" with one line of text: "help".