Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27348

VS 2010 I have an array of singles that I need to pass into a function as an intptr

$
0
0
Hi,

I've read lots of posts on pointers, but I still don't know how to do the above.

This is the function:

Code:

Private Shared Function ca_array_put_callback(ByVal datatype As CaRequestDataTypeEnum, ByVal count As CaUnsignedLong, ByVal chid As IntPtr, ByVal PValue As IntPtr, _
                                          ByVal pfunc As IntPtr, ByVal UserArgs As CaPvInfo) As CaErrorCodeEnum

PValue is the bit I'm struggling with passing to the function.

This is my code so far:

Code:

Public Function putvalue_Callback(setvalue As Single) As CaErrorCodeEnum
            'write a single precision value to the pv
            Dim setvalues(0) As Single
            setvalues(0) = setvalue
            Dim ptr_Set_Values As IntPtr
            ptr_Set_Values = setvalues ' This is the line with the error
            Return putvaluesarray(setvalues)
        End Function


(chid is assigned a value by an external function so can't get syntax from there)

Thanks

Kristian

Viewing all articles
Browse latest Browse all 27348

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>