Allocating Executable Memory
Conor P. Cahill
cpcahil at virtech.UUCP
Fri Sep 15 14:16:41 AEST 1989
In article <1767 at convex.UUCP>, mercer at convex.com (Randall Mercer) writes:
> I would like to allocate a chunk of executable memory, write code into
> it and then execute it. What versions of what vendors Unix OS's support
> this feature? I know Sun and Convex have mmap system functions for
> this and for allocating shared memory, etc. Is this a common feature?
> Is mmap likely to be supported by a growing number of vendors?
I worked on a project a couple of years ago that used System V shared memory
to implement a shared library feature for an office automation system.
Library functions were executed out of the shared memory segments.
We were able to do this on every system that we tried (which did include a
sun 3 (if i remember correctly)). In order to make the porting easier, I
wrote a program that was used to test this feature by attaching a shared
memory segment, copying text from a function in the program to the shared
memory segment and then assigning the location of the shared memory segment
to a function pointer (this wont be "legal" under ansi-c, and it did generate
a compiler warning, but it worked) and then using the pointer to test
the execution of the text in the shared memory segment.
--
+-----------------------------------------------------------------------+
| Conor P. Cahill uunet!virtech!cpcahil 703-430-9247 !
| Virtual Technologies Inc., P. O. Box 876, Sterling, VA 22170 |
+-----------------------------------------------------------------------+
More information about the Comp.unix.questions
mailing list