Results 1 to 5 of 5

Thread: Passing Byte arrays to a function...?

  1. #1

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Unhappy Passing Byte arrays to a function...?

    Ok, I know a funtion can return a byte array:
    VB Code:
    1. Private Function Woof() As Byte()
    2.    'Blah Blah
    3. End Function
    Now why can't I do this:
    VB Code:
    1. Private Function Woof(ByVal Buffer() As Byte) As Byte()
    2.    'Blah Blah
    3. End Function

    But...ByRef works!!! Hmmmmmmmmm...any ideas?

    Woka

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    Erm...you can't pass any kind of array as ByVal.
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106
    Passing an array ByRef is simple, you're only passing in the address of the first element (just like in C). However, if you were to pass in the array ByVal, you push the argument list onto the stack. Pushing an array of known size onto the stack could get really ugly, pushing an array of unknown size would be downright foolish.

  4. #4

  5. #5

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Public Enums in classes...how to decalre them???

    OK, I have 2 DLLs I want the same Enums in both...Should I just add a private class and just add all my enums publicly in there.
    God knows why you can't define them in a module?

    Woka

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width