![Avatar](https://opcfoundation.org/wp-content/uploads/sp-resources/forum-avatars/defaults/admindefault.png)
05/30/2017
![sp_UserOfflineSmall](https://opcfoundation.org/wp-content/sp-resources/forum-themes/reboot/images/darkpack/sp_UserOfflineSmall.png)
I am not certain you can use "C" to develop OPC COM applications since the OPC proxy/stubs have C++ constructs in them such as classes and interfaces. Did you mean C++?
There is a simple C++ client sample in this download:
https://opcfoundation.org/deve.....e-servers/
It is only available to OPC Foundation members.
![Avatar](https://opcfoundation.org/wp-content/uploads/sp-resources/forum-avatars/defaults/userdefault.png)
02/24/2014
![sp_UserOfflineSmall](https://opcfoundation.org/wp-content/sp-resources/forum-themes/reboot/images/darkpack/sp_UserOfflineSmall.png)
Actually, the header files generated by the MIDL compiler (including those that OPC Foundation already distributes such as opcda.h; or you can generate from the .IDL files) can be fed into plain C compiler. The definitions emitted by the compiler look e.g. like this:
#if defined(__cplusplus) && !defined(CINTERFACE)
....
#else /* C style interface */
....
#endif
with the main differences being that there is an additional "This" argument to each method call, 'struct'-s are used instead of interfaces, and instead of 'virtual', pointers to functions are used.
So, you can look for C++ examples instead, and then translate them to C relatively easily. It's mainly/just syntactic differences. Not that it would be a fun work to do; and the resulting code won't look nice either.
1 Guest(s)