Announcement

Collapse
No announcement yet.

Passing 32-bit Pointers

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

  • Jason McCarver
    Guest replied
    You cannot have a PTR as a parameter in SUBs or FUNCTIONs, so use DWORD instead (Unsigned 32 bit)

    The technique I use is to pass the parameter as a DWORD...something like this:

    Code:
    DIM aPtr AS BYTE PTR
    aPtr = VARPTR32(SomeVarb)
    
    CALL aProc(aPtr)
    
    SUB aProc (BYVAL InPtr AS DWORD)
      DIM SomePtr AS BYTE PTR
    
      SomePtr = InPtr
      ...
    END SUB
    HTH,
    Jason

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

    Leave a comment:


  • Walt Decker
    started a topic Passing 32-bit Pointers

    Passing 32-bit Pointers

    I've tried to pass 32-bit pointers to procedures but have had little luck. The only way I've been able to use pointers in a procedure is to declare them shared. The semantics I've tried are:

    DIM aPtr AS BYTE PTR

    aPtr = VARPTR32(SomeVarb)

    CALL aProc(aPtr)
    Call aProc1(aPtr)

    SUB aProc(BYVAL SomePtr AS PTR)

    SUB aProc1(BYVAL SomePtr AS DWORD PTR)

    Am I missing something?
Working...
X
😀
🥰
🤢
😎
😡
👍
👎