comp.lang.ada
 help / color / mirror / Atom feed
* Mapping c++ type VARIANT to Ada
@ 2002-10-06 18:27 Björn Lundin
  2002-10-06 19:16 ` Jeffrey Carter
  2002-10-07  3:21 ` SteveD
  0 siblings, 2 replies; 5+ messages in thread
From: Björn Lundin @ 2002-10-06 18:27 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=us-ascii, Size: 1606 bytes --]

Hello!
I'm trying to interface to an OPC Dll on W2k, which uses callbacks.

What I've done successfully do far is to set up a procedure to be runned by 
the dll, as a callback. I get the callback, and can interpret some of its 
contents, but I fail when I map a c++ VARIANT type.

The dll looks like this:

void CALLBACK EXPORT OPCUpdateCallback (HANDLE hGroup, HANDLE hItem, VARIANT 
*pVar, FILETIME *pTimeStamp, DWORD *pQuality)

I mapped it like this to a procedure like this:

  type Opc_Callback_Handler_Type is access protected
          procedure(Group     : Group_Handle_Type;
                    Item      : Item_Handle_Type;
                    Value     : Byte_Array_Ptr;
                    Timestamp : File_Time_Type;
                    Quality   : D_Word);

where I also have these definitions

  package C renames Interfaces.C;

  type Byte is range 0..255;
  for Byte'Size use 8;
  type Byte_Array is array (Natural range <>) of aliased Byte;

  type Byte_Array_Ptr is access all Byte_Array(1..16);

  type Server_Handle_Type is new C.Long;
  type Group_Handle_Type  is new C.Long;
  type Item_Handle_Type   is new C.Long;
  type D_Word is range 0 .. 2**16 -1;
  for D_Word'Size use 16;

  type File_Time_Type is record
      Low_Date_Time  : C.Long := C.Long'First;
      High_Date_Time : C.Long := C.Long'First;
  end record;



I get the Group and the Item and something in the byte_array, that seems to 
change fairly ok accordingly to the callback, but the filetime and quality 
is not reported, which makes me thing that my VARIANT mapping is wrong?

Any suggestions?

/Bj�rn
  



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-10-07 16:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-06 18:27 Mapping c++ type VARIANT to Ada Björn Lundin
2002-10-06 19:16 ` Jeffrey Carter
2002-10-07 16:10   ` Björn Lundin
2002-10-07  3:21 ` SteveD
2002-10-07 16:00   ` Björn Lundin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox