|
Simon, The non-ILE programs wouldn't do anything with it but pass it back to an ILE program. I liked the 8-byte non-quad word aligned because it would enable me to not worry about alignment in OPM programs. As for the flaw in design, I'm not sure I agree. As long as I tell the consumer of the API that "this is a handle, leave it alone!" I don't see why I need to stay away from passing the pointer. Smart handles are used all over the place, take a look at the socket-handle in TCP, it's the port number, but it doesn't need to be. Because of the difficulties with Teraspace I may still end up with an integer "handle" into an array that contains the pointers, it just seems like extra work. -Walden ------------ Walden H Leverich III President Tech Software (516)627-3800 x11 WaldenL@TechSoftInc.com http://www.TechSoftInc.com -----Original Message----- From: Simon Coulter [mailto:shc@flybynight.com.au] Sent: Saturday, December 22, 2001 22:09 To: midrange-l@midrange.com Subject: Re: Teraspace memory allocation Hello Walden, You wrote: >I hoped I could pass them around to non-ILE >programs as 8-byte character arrays. Firstly, what use would they be to non-ILE programs? Secondly, I think there is a fundamental flaw in your design. You should not be exposing the TS address as the magic cookie cum handle. Your teraspace service program should allocate a chunk of static storage (array, user space, user index, whatever) and your new() function should store the TS pointer in the array and return a handle that can be used by destroy() and any other TS functions to locate the pointer in the static storage. That way you don't expose the implementation, you don't have to stuff about with pointer conversions, and the handle can be a data type supported by all HLLs. The simplest handle is an integer as an index into the array but it could be anything you like and its internal structure can be changed as required by the TS service program without breaking existing code. TS exists only for the duration of a job/process thus a handle cannot be stored externally to the process and reused in a different process. You could use the job ID as part of the handle to allow you to test and enforce this requirement. If you really must expose the 8-byte TS pointer then you will have to write a C procedure to handle the TS functions. That way new() can declare a __ptr64 data type for the TS allocation and pass it back as a char(8) data type -- I haven't tried that but I suspect it would work. The other TS functions would accept the char(8) and convert it to a__ptr64 and use it. Regards, Simon Coulter. -------------------------------------------------------------------- FlyByNight Software AS/400 Technical Specialists http://www.flybynight.com.au/ Phone: +61 3 9419 0175 Mobile: +61 0411 091 400 /"\ Fax: +61 3 9419 0175 mailto: shc@flybynight.com.au \ / X ASCII Ribbon campaign against HTML E-Mail / \ -------------------------------------------------------------------- _______________________________________________ This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/midrange-l or email: MIDRANGE-L-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.