[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re- A C pointer passed to LISP
- To: SHEN@DOLPHIN.JPL.NASA.GOV
- Subject: Re- A C pointer passed to LISP
- From: STEVE.M@AppleLink.Apple.COM (Aladdin Systems,Steven Mitchell,PRT)
- Date: 12 Feb 92 07:39 GMT
- Cc: INFO-MCL@CAMBRIDGE.APPLE.COM
To: Sheldon Shen, shen@dolphin.Jpl.Nasa.Gov
cc: info-mcl
From: Steve Mitchell
Date: 02-11-92
Sub: A C pointer passed to LISP
> In my program, I pass a C pointer to LISP. It is a pointer to a
> STRUCT that maintains the status of a database.
> Eval (zone-pointer my-pointer) returns NIL. I guess it means that
> this is a relocatable pointer.
Not at all; your struct may be allocated on the stack. And take
note that the docs for zone-pointerp make it clear that it is the
memory block, not the pointer, that may or may not be relocatable.
> Repeatedly updating the database (or repeatedly using this pointer)
> eventually crashes the system.
It doesn't sound like you're actually getting your pointer into MCL.
Perhaps the argument type, order, or argument-passing method is not
specified correctly in your interface definition.
> Is there anyway to force a relocatable pointer non-relocatable?
Pointers point to non-relocatable heap storage. #_NewHandle
allocates a relocatable heap block and returns a HANDLE to it. You
can call #_HLock on the handle to make its block non-relocatable.