Original Post
I have tried compiling the following code and get a compiler error. I get compiler error CS0212: "You can only take the address of an unfixed expression inside of a fixed statement initializer". After looking at the MSDN article, I can not figure out how to implement a fixed statement in this context. If there is another way to do this, I'd love to hear it. Any help would be very appreciated! The MSDN article can be found here.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace WindowsFormsApplication1
{
unsafe class ALPapi2
{
public static long ALP_DEFAULT = 0L;
public static long deviceid = 0;
public static long returnvalue = 0;
[DllImport("alp3S.dll", CallingConvention = CallingConvention.ThisCall)]
public static extern long AlpDevAlloc(long DeviceNum, long InitFlag, long* DeviceIdPtr);
public static void initialize()
{
returnvalue = AlpDevAlloc(ALP_DEFAULT, ALP_DEFAULT, &deviceid);
}
}
}