From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.4 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00, PP_MIME_FAKE_ASCII_TEXT autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,a94db636886834db,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-10-06 11:26:29 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!192.71.180.34!newsfeed1.swip.net!swipnet!nntpserver.swip.net!not-for-mail From: =?ISO-8859-1?Q?Bj=F6rn?= Lundin Subject: Mapping c++ type VARIANT to Ada Newsgroups: comp.lang.ada User-Agent: KNode/0.7.1 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit Message-ID: NNTP-Posting-Host: 213.101.77.43 X-Complaints-To: news-abuse@swip.net X-Trace: nntpserver.swip.net 1033928776 213.101.77.43 (Sun, 06 Oct 2002 20:26:16 MET DST) NNTP-Posting-Date: Sun, 06 Oct 2002 20:26:16 MET DST Organization: A Customer of Tele2 X-Sender: x-367446@d213-101-77-43.swipnet.se Date: Sun, 06 Oct 2002 20:27:48 +0200 Xref: archiver1.google.com comp.lang.ada:29544 Date: 2002-10-06T20:27:48+02:00 List-Id: 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