Hello Guest it is March 28, 2024, 06:44:06 PM

Author Topic: cant add the Mach4CoreDll to c# project  (Read 947 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,544 1,544
  • "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