Hello Guest it is November 16, 2019, 06:51:11 PM

Author Topic: cant add the Mach4CoreDll to c# project  (Read 154 times)

0 Members and 1 Guest are viewing this topic.

cant add the Mach4CoreDll to c# project
« 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?

Offline smurph

*
  • *
  •  1,149 1,149
  • "That there... that's an RV."
    • View Profile
Re: cant add the Mach4CoreDll to c# project
« Reply #1 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