|
-----Message d'origine-----imrworldwide%2Ecom%2Fcgi%2Dbin%2Fa%2Fci%5F450304%2Fet%5F2%2Fcg%> 5F801459%2Fpi%5F1004813%2Fai%5F866383&_t=758314219&_r=carpoint
De : rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] De la part de Larry Ducie
Envoyé : samedi 1 août 2009 01:25
À : RPG400
Objet : Re: pointer problem
Hi David,
I agree with Scott on this one.
For example, the DS may simply be a template designed to
NEVER have memory allocated to it and you may be expected to
create your own DS likeDS the original DS. Allocating memory
to the original DS and using it could be disasterous, or at
the very least useless.
Alternatively, the pointer may need to be passed to an API.
In this case allocating memory to the basing pointer would be
required. But how much memory should you allocate? The amount
of memory to allocate may be determined by other API calls
and can not be deduced a priori, or it may be obvious from
the API docs and constant.
A further option is that there is a second pointer which is
allocated the total memory required and the basing pointer
you have your DS based on is simply used to overlay the DS
over the original pointer data at specified offsets. The data
could be allocated sirectly using the %alloc BIF or could be
inside a User Space - as in many list API results.
The point is, the solution is in your application code and
can not be provided by glib answers from us based on one or
two lines of sample code. You need to know what it is you are
trying to do with this based DS in order have a complete
picture of the process involved. Once you have this
knowledge, however, you will probably not need any of us to
help you. You will now know whether you should be allocating
memory to the pointer or creating a copy DS and using that instead.
Catch 22.
Not helpful, but the best I can offer, other than
generalisations and lists of possible solutions. If you are
using pointers, it is not the time to experiment with
possibilities - you need to know exactly what you are doing.
Cheers
Larry Ducie
_________________________________________________________________
Need a new model in your life? Sell your car fast.
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fsecure%2Dau%2E
--
This is the RPG programming on the IBM i / System i
(RPG400-L) mailing list To post a message email:
RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change
list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-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.