From: Thaddeus L Olczyk
Subject: Memory mapped files.
Date: 
Message-ID: <3c5cc77a.561603078@nntp.interaccess.com>
Is there a way of doing memory mapped files in Lisp?

Also, is there a way of overlaying structures on raw memory ala C
structs.

Ex:

At memory located at base:

base: integer
base+sizeof(int): foo
base+sizeof(int)+sizeof(foo): foo
base+sizeof(int)+2*sizeof(foo): foo
base+sizeof(int)+3*sizeof(foo): foo

struct foo
{
    char bar[20];
    int bar_len;
    char bar_d[10];
    int bar_d_len;
};

vector<foo> foo_list;
int num=*(int *)base;
int i;
foo *ptr=(foo *)(((int *)base)++);
for(i=0;i<num;i++)
{
   foo  a=*ptr++;
   foo_list.push_back(a);
}       

From: Wade Humeniuk
Subject: Re: Memory mapped files.
Date: 
Message-ID: <a3ijj9$7gr$1@news3.cadvision.com>
Which implementation of Lisp?  Most CLs have a FLI interface.  They usually
can create a foreign type that maps to a C struct.

Wade

"Thaddeus L Olczyk" <······@interaccess.com> wrote in message
·······················@nntp.interaccess.com...
> Is there a way of doing memory mapped files in Lisp?
>
> Also, is there a way of overlaying structures on raw memory ala C
> structs.
>
> Ex:
>
> At memory located at base:
>
> base: integer
> base+sizeof(int): foo
> base+sizeof(int)+sizeof(foo): foo
> base+sizeof(int)+2*sizeof(foo): foo
> base+sizeof(int)+3*sizeof(foo): foo
>
> struct foo
> {
>     char bar[20];
>     int bar_len;
>     char bar_d[10];
>     int bar_d_len;
> };
>
> vector<foo> foo_list;
> int num=*(int *)base;
> int i;
> foo *ptr=(foo *)(((int *)base)++);
> for(i=0;i<num;i++)
> {
>    foo  a=*ptr++;
>    foo_list.push_back(a);
> }
>
>
From: Scott McKay
Subject: Re: Memory mapped files.
Date: 
Message-ID: <pbb78.72296$Ln2.16089307@typhoon.ne.mediaone.net>
In the absence of any other information, I would guess that you will
have to be careful of interactions with the GC when you do this.  I
think Wade's question "what implementation?" is the key question.

"Wade Humeniuk" <········@cadvision.com> wrote in message
·················@news3.cadvision.com...
> Which implementation of Lisp?  Most CLs have a FLI interface.  They
usually
> can create a foreign type that maps to a C struct.
>
> Wade
>
> "Thaddeus L Olczyk" <······@interaccess.com> wrote in message
> ·······················@nntp.interaccess.com...
> > Is there a way of doing memory mapped files in Lisp?
> >
> > Also, is there a way of overlaying structures on raw memory ala C
> > structs.
> >
> > Ex:
> >
> > At memory located at base:
> >
> > base: integer
> > base+sizeof(int): foo
> > base+sizeof(int)+sizeof(foo): foo
> > base+sizeof(int)+2*sizeof(foo): foo
> > base+sizeof(int)+3*sizeof(foo): foo
> >
> > struct foo
> > {
> >     char bar[20];
> >     int bar_len;
> >     char bar_d[10];
> >     int bar_d_len;
> > };
> >
> > vector<foo> foo_list;
> > int num=*(int *)base;
> > int i;
> > foo *ptr=(foo *)(((int *)base)++);
> > for(i=0;i<num;i++)
> > {
> >    foo  a=*ptr++;
> >    foo_list.push_back(a);
> > }
> >
> >
>
>