OPC Client applicaiton|Classic OPC: DA, A&E, HDA, XML-DA, etc.|Forum|OPC Foundation

Avatar
Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
Lost password?
sp_Feed sp_PrintTopic sp_TopicIcon
OPC Client applicaiton
Avatar
Nikola Stojkov
Member
Members
Forum Posts: 3
Member Since:
10/10/2017
sp_UserOfflineSmall Offline
1
10/10/2017 - 00:53
sp_Permalink sp_Print

Hello everyone,

I'm working on OPC Client application in C language.

I installed OPC Core components but i'm not sure how to proceed to make Client application using

Core components DLL's. Is there some example of OPC Client written in C ?

Thank you!

Avatar
Randy Armstrong
Admin
Forum Posts: 1438
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
2
10/10/2017 - 05:41
sp_Permalink sp_Print

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
Nikola Stojkov
Member
Members
Forum Posts: 3
Member Since:
10/10/2017
sp_UserOfflineSmall Offline
3
10/10/2017 - 06:21
sp_Permalink sp_Print

Thank you for reply!

I was referring to C not C++, because i have C application which i need to integrate OPC client into.

Avatar
Zbynek Zahradnik
Member
Members
Forum Posts: 62
Member Since:
02/24/2014
sp_UserOfflineSmall Offline
4
10/10/2017 - 07:21
sp_Permalink sp_Print

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.

Avatar
Nikola Stojkov
Member
Members
Forum Posts: 3
Member Since:
10/10/2017
sp_UserOfflineSmall Offline
5
10/11/2017 - 05:43
sp_Permalink sp_Print

Thank you for reply!

So i need to be a member to be able to download example.

Is there maybe free OPC Client examples that you know? 

Forum Timezone: America/Phoenix
Most Users Ever Online: 510
Currently Online:
Guest(s) 20
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Forum Stats:
Groups: 2
Forums: 10
Topics: 1341
Posts: 4546