Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: KatzYaakov on January 15, 2019, 12:12:10 PM

Title: cant add the Mach4CoreDll to c# project
Post by: KatzYaakov on January 15, 2019, 12:12:10 PM
i want to add the dll for api to my c# project
but cant add
how can i do it?
Title: Re: cant add the Mach4CoreDll to c# project
Post by: smurph on January 15, 2019, 11:03:56 PM
The DLL isn't a COM object or an assembly.  It is an old school (non .Net) API DLL.  So you cannot add it as a reference like that.  You have to use it like you would any WINAPI type DLL.

e.g. this will define mcAxisDeref()
Code: [Select]
[DllImport("Mach4Core.dll", CallingConvention = CallingConvention.StdCall)]
        [return: MarshalAs(UnmanagedType.I4)]
        public static extern int mcAxisDeref(
                [param: MarshalAs(UnmanagedType.I4)]  int mInst,
                [param: MarshalAs(UnmanagedType.I4)]  int axis);

Steve