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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,91c8a2ba0b435b28,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-03-17 11:45:43 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-06!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: Brian Palmer Newsgroups: comp.lang.ada Subject: Interfacing Generics with C Pointers Date: Mon, 17 Mar 2003 13:56:29 +0000 Organization: ELMCO Message-ID: User-Agent: KNode/0.7.1 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Complaints-To: abuse@supernews.com Xref: archiver1.google.com comp.lang.ada:35420 Date: 2003-03-17T13:56:29+00:00 List-Id: I've got a problem where I get in a pointer to a block of memory that was allocated in C++. In addition to the pointer, I get the number of bytes that were allocated. The Ada type that the memory comes in as is a pointer to an unconstrained byte array. Whenever I try to dereference the pointer, I get a CONSTRAINT ERROR. I think the problem is due to the compiler trying to access a storage location within the type that tells how many bytes are there. I feel like I could constrain the base type and get around the problem, however, this mechanism is used for several different size blocks of memory, several hundred times per second, and I don't want to have to allocate more memory than necessary. Any ideas how to access unconstrained memory without the compiler looking for that built in element? Any help would be appreciated. -Brian Palmer