Re: DLM memory space behavior. [message #30630] |
Tue, 14 May 2002 01:47 |
Nigel Wade
Messages: 286 Registered: March 1998
|
Senior Member |
|
|
Ed Wright wrote:
>
> To: IDL
> From: Ed Wright
>
> A question concerning memory space and dlm usage. I am working to separate
> a set of test code from my dlm project into a second dlm. The test code
> creates/loads/deletes a number of temporary test files. I discovered a
> file loaded by C code from one dlm cannot be accessed by C code in another
> dlm. (All file loading/unloading occurs within C code, not the IDL
> environment.)
>
> Is this correct?
>
I wouldn't have thought so. I'm not totally sure what you mean by "a file
loaded by C code", but memory allocated within one DLM shoule be accessible
to any other DLM. I know this is the case with UNIX, but I have no idea
about Windows.
The days of overlays are long gone, and all memory should be available at
any location in the code. If you have some memory allocated within one DLM,
that memory is still part of the overall memory space of the application
and another DLM should be able to access it provided it can get a valid
pointer to the memory.
How are you creating the space to store the contents of the file?
I'd have thought you could declare a global variable in the DLM that
allocates the memory, and extern this variable in the other DLM. You then
need to build the DLMs so that global symbols are exported. This can be
done with the flavours of UNIX I'm familiar with.
Alternatively you can return a pointer to IDL from one DLM and pass it on
to the other DLM. I do this with pointers returned by malloc to pass memory
locations between DLMs.
--
-----------------------------------------------------------
Nigel Wade, System Administrator, Space Plasma Physics Group,
University of Leicester, Leicester, LE1 7RH, UK
E-mail : nmw@ion.le.ac.uk
Phone : +44 (0)116 2523568, Fax : +44 (0)116 2523555
|
|
|