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

0 Members and 1 Guest are viewing this topic.

Offline KatzYaakov

  • Active Member
  • Posts: 42
    • View Profile
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

  • Administrator
  • *
  • Posts: 1,053
  • "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