Announcement

Collapse

New Sub-Forum

In an effort to help make sure there are appropriate categories for topics of discussion that are happening, there is now a sub-forum for databases and database programming under Special Interest groups. Please direct questions, etc., about this topic to that sub-forum moving forward. Thank you.
See more
See less

Passing 32-bit Pointers

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

  • 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?
    Walt Decker

  • #2
    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

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

    Comment

    Working...
    X