I have a function in a C++ dll defined as
im trying to figure out how to pass the data for the logData element..Code:FMSIO_API BOOL SetLogData( const char *dbName, int id, int boreholeID, int nameID, float startDepth, float depthSampleRate, int values_NUM_PTS, float * logData, const char *apiCode "UNKNOWN", const char *runDate "00:00:00");
I declare
and then tryCode:<DllImport("c:\windows\system32\FMSIO.dll", EntryPoint:="#35", CallingConvention:=CallingConvention.Cdecl)> Public Shared Function SetLogData(ByVal dbName As String, ByVal id As Int32, ByVal boreholeID As Int32, ByVal nameID As Int32, ByVal startDepth As Single, ByVal depthSampleRate As Single, ByVal values_NUM_PTS As Int32, ByVal logdata() As Single) As Int32
but this just results in an error:Code:Dim logdataout() As Single Dim logdataptr As System.IntPtr logdataout(0) = 5 logdataout(1) = 4 logdataout(2) = 5 logdataout(3) = 5 logdataout(4) = 4 t = s.SetLogData("C:\FMS2_build.mdb", 6724, 1006, 1407, 100, 0.1524, 5, logdataout())
so I guess I am passing the data the wrong way - can anyone correct the above and show me how to pass an array of singles/floats by value like this?Code:An unhandled exception of type 'System.NullReferenceException' occurred in FMSLoad.exe Additional information: Object reference not set to an instance of an object.




Reply With Quote