Posted by: roup21 | October 31, 2008

Parameter

About Function Parameters.

1. ‘As Any’.    ‘As Any’ is used by MS to flag functions which contain parameters which can accept a string or numerical argument.  You should never use this in VB; instead create aliases such as FooByNum/FooByString.
    I have found no way to detect such parameters; LPVOID is translated ‘As Any’.   You must create the aliases when you find you need them.

2. ‘ByRef/ByVal’.   This version supplies the ‘ByRef’ or ‘ByVal’ qualifier for function declarations.   C Integers and Longs are translated as Long.   Character types are translated as Byte or String.

3. Pointers to Arrays.   Pointers to arrays are translated as the array’s datatype and passed ByRef.   Pass the first element of the array when calling the function.   Ex: “ArrayName(0)”.

4. Pointers to numbers.   In general, pointers are translated as the datatype they point to and passed ByRef.   This causes VB to create a pointer and pass it to the function.

5. Pointers to Strings.   Strings work exactly the opposite to numbers.  Pointers to strings are translated as String passed ByVal.   VB will create a pointer to the String and pass it to the function.

6. Pointers to functions.   Pointers to functions are translated as Long.   You must have a dll containing the callback function to use these functions from VB, and the dll will probably manage such calls itself.

7. Variable names.   Most C function prototypes list only the datatype of parameters.   Arbitrary names are provided for variables (x1,x2,…).    

8. Unrecognized datatypes.   If a datatype is not recognized, it is transliterated.   Check the ‘Unknown’ list or the header file if the datatype is not apparent. 

9. Hardcoded argument values.    A few functions have hardcoded argument values.   These are rendered with the C value as the datatype.  Ex: ( ‘ x as 0×16 ‘ )

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Categories

Follow

Get every new post delivered to your Inbox.