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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,529481ac2d77d9f6 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!n59g2000hsh.googlegroups.com!not-for-mail From: vienapl@hotmail.com Newsgroups: comp.lang.ada Subject: Re: Translating a VB dll header to Ada Date: 12 Apr 2007 07:17:46 -0700 Organization: http://groups.google.com Message-ID: <1176387466.525266.257670@n59g2000hsh.googlegroups.com> References: <1176320910.543255.74730@b75g2000hsg.googlegroups.com> NNTP-Posting-Host: 217.126.90.204 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1176387466 20347 127.0.0.1 (12 Apr 2007 14:17:46 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 12 Apr 2007 14:17:46 +0000 (UTC) In-Reply-To: User-Agent: G2/1.0 X-HTTP-UserAgent: Opera/9.10 (Windows NT 5.1; U; en),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: n59g2000hsh.googlegroups.com; posting-host=217.126.90.204; posting-account=s-5BYg0AAACg_1u2WqCKSiLkbvMBVIC_ Xref: g2news1.google.com comp.lang.ada:14936 Date: 2007-04-12T07:17:46-07:00 List-Id: Although the header I'm trying to translate is in VB6, I guess that the dll itself wasn't written with VB, but C++ instead. I actually also have availible the C header for it (http://pastebin.ca/436394), but I thought that the VB one was easier to understand and translate for somoene who only used a bit of Ada. In fact, if I try to build the test executable using Stdcall, I get compilation errors (undefined references to the functions). So I guess the C calling conention is right on this one. On Apr 12, 10:06 am, "Dmitry A. Kazakov" wrote: > On 11 Apr 2007 12:48:30 -0700, vien...@hotmail.com wrote: > > > I'm a really unexperienced programmer who trying to call a dll from > > Ada code. It compiles properly, but after some function calls I get > > the following error: raised PROGRAM_ERROR : > > EXCEPTION_ACCESS_VIOLATION. > > > The VB code is the following: > > I am not an expert in VB, but for what it is worth > > 1. Microsoft changes VB permanently, you should really mention the version > number of the Beast. (:-)) > > 2. The VBs I dealt with didn't used C convention. In your sources I see > > pragma Import (C, ...); > > This means a C convention (cdecl in Windows terms), but it should be > stdcall instead: > > pragma Import (stdcall, ...); -- If you are using GNAT > > 3. Passing strings from/to VB is a mess. I don't remember the details, > sorry. Maybe others could comment on that. > > -- > Regards, > Dmitry A. Kazakovhttp://www.dmitry-kazakov.de