32 to 64 bits portability|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
32 to 64 bits portability
Avatar
Estanislao Musulin
New Member
Members
Forum Posts: 2
Member Since:
01/23/2017
sp_UserOfflineSmall Offline
1
01/23/2017 - 07:48
sp_Permalink sp_Print

Hi,

I have old c++ code from an HDA server that works on 32bits. I will like to compile it in 64 bit but I am having problems with truncation from OPCHANDLE to HANDLE. 

OPCHANDLE is defined as a DWORD (4 bytes) and HANDLE is 8 bytes long in x64 machines. 

So, my question is,  there exist new opc headers to compile in 64 bits (opchda.h, etc.)? or should  I handle this problem in my code?

Thnks

Estanislao

Avatar
Zbynek Zahradnik
Member
Members
Forum Posts: 62
Member Since:
02/24/2014
sp_UserOfflineSmall Offline
2
01/23/2017 - 08:57
sp_Permalink sp_Print

OPCHANDLE is DWORD (4 bytes, 32 bits) in 64-bit OPC world as well. It has to be, so that the servers and clients with differing bitnesses can interoperate.

The HANDLE (be it whatever it is) has nothing to do with it.

I can imagine that some existing 32-bit code may be storing pointers to OPCHANDLE, and of course that won't work in 64-bits. In such case the code has to be rewritten to define its handles differently - usually, some kind of  "map" (dictionary) structure between the pointers and the actual handles will do.

Best regards

Zbynek Zahradnik

Avatar
Estanislao Musulin
New Member
Members
Forum Posts: 2
Member Since:
01/23/2017
sp_UserOfflineSmall Offline
3
01/23/2017 - 09:10
sp_Permalink sp_Print

thank you!

Avatar
lpereira@neadvance.com_1
New Member
Members
Forum Posts: 1
Member Since:
12/17/2019
sp_UserOfflineSmall Offline
4
12/17/2019 - 10:45
sp_Permalink sp_Print

Hi,

I'm having the same issue, is there a safe and easy way to solve the problem?

Avatar
Randy Armstrong
Admin
Forum Posts: 1564
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
5
12/17/2019 - 11:33
sp_Permalink sp_Print

Not sure what you are looking for. Zbynek explained how to safely use the handles.

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