Announcement

Collapse
No announcement yet.

How to get dynamic string handle address?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Tom Hanlin
    replied
    Oh, I see. If you want to get the string handle when all you have is
    the data pointer... no, you're pretty much out of luck.

    Although... there would seem to be some question as to whether that's
    actually the case. If you're passing a genuine STRING type, the result
    result is always going to be a string handle, not a data pointer. It
    doesn't matter whether you use BYREF or BYVAL. A STRING is a STRING.
    No? There may be a question of whether PB would decide to deallocate
    the string if it detects a "temporary" handle, though. DOS BASICs were
    designed with the idea of being able to call asm, not being called from
    asm.

    ------------------
    Tom Hanlin, PowerBASIC Staff
    Opinions expressed may not be those of my employer or myself

    Leave a comment:


  • Clay Clear
    replied
    Disregard, no longer need replies. I just recoded my UNIT
    procedures so they use BYVAL STRING instead of BYREF strings.
    So, my OBJ procedures and the UNIT procedures can now freely
    "talk to each other."


    ------------------

    Leave a comment:


  • Clay Clear
    replied
    Thank you for your replies. Of course, Tom, those would be obvious,
    EXCEPT that its procedures in my OBJ files that need the info, so
    STRPTR and VARPTR are not options.


    ------------------

    Leave a comment:


  • Michael Mattias
    replied
    >The only builtin PB/DOS string procedures I know of go the opposite direction

    PB/DOS offers a documented set of string management functions you might find useful.

    See: Help/Internal Procedures

    But - I don't think you can get from data address to handle.

    And when you think about it, it makes no sense to do so anyway.

    A procedure which takes a "BYVAL" parameter assumes that procedure does not need to modify that parameter; so the data are, "by definition," sufficient.

    Of course, that procedure could always create a LOCAL copy of the parameter and "do something" with that copy <U>locally</U>, but if the parameter was passed BYVAL it can't be changed anyway.


    Leave a comment:


  • Tom Hanlin
    replied
    STRPTR points to the data. VARPTR points to the string.

    ------------------
    Tom Hanlin, PowerBASIC Staff
    Opinions expressed may not be those of my employer or myself

    Leave a comment:


  • Clay Clear
    started a topic How to get dynamic string handle address?

    How to get dynamic string handle address?

    What I mean is, I have some OBJ ASM procedures that take BYVAL STRING
    arguments. Some of them could potentially need to call PBU UNIT procedures
    that take BYREF STRING arguments. So, how can I go from a string
    handle to the address of the string handle? The only builtin
    PB/DOS string procedures I know of go the opposite direction.

    Thank you for any assistance.



    ------------------
Working...
X