I wonder if I can work with progress in memory pointer . Must also create linked list , stack, queue , etc ... for a college work and do not want to do in C / C ++ language. Can anyone help me or send some sample code because I have experience in progress but never worked with memory pointer. Thank you!
We have had to use a MEMPTR typically when integrating with a 3rd party dll.
The following RUN statement will make a call to MTX_GET_CashierDisplay which will return the text we are looking for. A similar approach would be used when sending info to the dll.
DEF VAR cCashierDisplay AS CHAR NO-UNDO.
RUN MTX_GET_CashierDisplay1 (OUTPUT cCashierDisplay).
The following are defined in a persistent procedure.
PROCEDURE MTX_POS_GET_CashierDisplay1 EXTERNAL {&MTX_POS} PERSISTENT:
DEFINE OUTPUT PARAMETER CashierDisplay1 AS MEMPTR NO-UNDO.
END PROCEDURE.
PROCEDURE MTX_GET_CashierDisplay1 :
DEFINE OUTPUT PARAMETER pcCashierDisplay1 AS CHARACTER NO-UNDO.
DEFINE VARIABLE mCashierDisplay1 AS MEMPTR NO-UNDO.
SET-SIZE(mCashierDisplay1) = 20.
RUN MTX_POS_GET_CashierDisplay1 (OUTPUT mCashierDisplay1).
ASSIGN pcCashierDisplay1 = GET-STRING(mCashierDisplay1,1).
SET-SIZE(mCashierDisplay1) = 0.
RETURN.
END PROCEDURE.
Do you need to interface to a DLL/shared object? Using memptrs just for the sake of using memptrs is a lot of code whose purpose would not be readily obvious to the user. If you just have to represent an abstract data type in some language, I'd probably go with OOABL objects instead, implementing an interface with Next and Previous methods/properties.
If you do have to access a DLL/shared object, take into consideration the PROCESS-ARCHITECTURE, as the size of pointers changes between 32-bit and 64-bit. You'd probably want to use at least 11.3 for this.
I totally agree with Garry. MEMPTRs are not the way to go. As he said - use OO, where you would have an object instance for each node in a linked list for example.
I started using Progress ages ago, just to avoid using memptrs, list and trees...
All that is inherent on the 4GL part of the name, didn't?
ps. I ended using mempointers on some two or three programs, but then again, all tree, and list stuff, came free with 4gl...;)
Using records for the data portions for various data structures makes sense since they are in the language already. I have a couple of data structures this way in my book available for free here amduus.com/.../