Hello Guest it is June 17, 2019, 03:23:33 AM

Author Topic: Connect to Mach4 using VS 2012 C++  (Read 238 times)

0 Members and 1 Guest are viewing this topic.

Connect to Mach4 using VS 2012 C++
« on: February 12, 2019, 01:07:54 AM »
Hello. Sorry to bother you. I want to connect to Mach4 using VS 2012 C++. I found the dll file in the Mach folder. In Mach4CoreApi, I found a description of the functions, it says "Define MACH_STATIC in your code before the MACAP.h file is included. This is required!" but I can’t find the MachApi.h or MACH_STATIC header anywhere. Could you tell me how to do this? I need to refer to errors and other variables that should be described, but since they are not described anywhere, I cannot do this.
Re: Connect to Mach4 using VS 2012 C++
« Reply #1 on: February 12, 2019, 04:37:31 AM »
Hi,
why? Lua is the scripting language provided....why not use it?

Craig
My wife left with my best friend...
     and I miss him!
Re: Connect to Mach4 using VS 2012 C++
« Reply #2 on: February 13, 2019, 03:02:14 AM »
You are proposing to use lua functions from C ++? I just need to make a window application, I have skills in working with C ++ but not with lua.
Re: Connect to Mach4 using VS 2012 C++
« Reply #3 on: February 13, 2019, 03:37:02 AM »
Hi,
so you want to use C++ because you are not familiar with Lua?

If you look at the API.chm the vast majority of APIs have both Lua and C++ syntax. Those few APIs that do not
have Lua bindings are intended for plugins only. Within those few exceptions anything you can do in C++ you can do in
Lua. Everything required to write, debug and run Lua code is ALREADY INCLUDED in Mach4.

No doubt you can use C++ but not as simply or easily as Lua, at the very least you will have to attach or integrate a C++
compiler/IDE.

Craig
My wife left with my best friend...
     and I miss him!
Re: Connect to Mach4 using VS 2012 C++
« Reply #4 on: February 13, 2019, 02:31:17 PM »
The key word in the api document under "supported platforms" is the word "plugins".  The SDK is only available for those writing hardware plugins. (Correct me if I am wrong guys)/

I have coded in C, C++, pascal and object pascal.  Learning LUA is painful but if you are going to use Mach4 for anything beside running gcode you would benefit from giving it a t try.  I have attached a link that demonstrates how to connect to mach4 and call the API functions from object pascal.  You should be able to modify it for C++ 

https://www.machsupport.com/forum/index.php?topic=34259.msg237003#msg237003

HTH

RT

Offline smurph

*
  • *
  •  1,094 1,094
  • "That there... that's an RV."
    • View Profile
Re: Connect to Mach4 using VS 2012 C++
« Reply #5 on: February 14, 2019, 12:18:39 AM »
One would need to link to MachAPI.dll via the MachAPI.lib to write a GUI to replace the Mach4GUI.exe.  Otherwise, an app to monitor or control the core along side the Mach4GUI would link to MachIPC.dll via MachIPC.lib.  MachAPI.h is the header to use with both of the link libraries.  All of these are in the SDK and require a developer key. 

Steve