LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Pinvoke signature for passing pointer to double

hi all

I am having a great problem. If there is someone who can solve the issue then that will be highly thankful

I have a dll developed in C++ registered on my system and there is a function defined in that dll with following signature

long PCMSLatLongsEnRoute(Trip trip, double* latlong, long numPairs, BOOL shpPts);

................

I want to use this function from c# application and I am getting Pinvoke error regarding function signature..

I have declared the function with given line...

[System.Runtime.InteropServices.DllImport("PCMSRV32.DLL", EntryPoint = "PCMSLatLongsEnRoute", ExactSpelling = false, CharSet = System.Runtime.InteropServices.CharSet.Ansi, SetLastError = true)]
    public static extern long PCMSLatLongsEnRoute(int tripID, ref double o,long a, Boolean b);

and I have used this function like....

long klp=0;
double d=0;
bool deft = true;
klp = PCMDLLINT.PCM.PCMSLatLongsEnRoute(tripID, ref d, klp, deft);


and the I am getting run time error...

A call to PInvoke function 'PCMDLLINT!PCMDLLINT.PCM::PCMSLatLongsEnRoute' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.


Best Regards
Manvinder Singh
0 Kudos
Message 1 of 2
(3,036 Views)
Why are you asking a question about C# on a LabVIEW board? Smiley Surprised

Perhaps the MSDN forums are a better choice?
0 Kudos
Message 2 of 2
(3,023 Views)