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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6ae109b8af68b4ac,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-01-09 12:18:14 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fr.clara.net!heighliner.fr.clara.net!freenix!enst!enst.fr!not-for-mail From: "Alexandre E. Kopilovitch" Newsgroups: comp.lang.ada Subject: Summary: GNAT and a very foreign DLL Date: Wed, 9 Jan 2002 23:19:53 +0300 (MSK) Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: avanie.enst.fr 1010607482 22789 137.194.161.2 (9 Jan 2002 20:18:02 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Wed, 9 Jan 2002 20:18:02 +0000 (UTC) To: comp.lang.ada@ada.eu.org Return-Path: X-Mailer: Mail/@ [v2.44 MSDOS] Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: comp.lang.ada mail<->news gateway List-Unsubscribe: , Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:18703 Date: 2002-01-09T23:19:53+03:00 Several days ago I asked in this newsgroup for a help with building an import library for some specific DLL. My statement of the problem was the following: ----- The problem appears to be with the combination of the call convention and the names of the DLL's entry points: the call convention is surely Stdcall, but the entry point names do not contain usual suffixes "@nn" - they look as common C identifiers. I looked into GNAT docs, and saw that although the review of the call conventions and the entry point naming strategies is quite comprehensive, not all possible combinations are supported with the pragmas. In particular, it seems that the combination of the Stdcall convention and the entry point name without "@nn" isn't supported - nether External_Name nor Link_Name nor other (linker's) options can help. [skip] So my question is: did I missing something in GNAT docs? Is there some regular way to specify within an Ada program _any_ name for a DLL's entry point, regardless of a call convention? ----- After that, Craig Carey wrote me (private message) about the gnatdll -k switch (and the dlltool --kill-at switch). That solved the problem completely. Then I looked into "Using gnatdll" section of GNAT User's Guide and found there a comprehensive description of those switches (including their purpose). So, another question arises: why I failed to find that piece of documentation when I needed it? The probable answer is that I was diverted from a further search by the phrase at the end of the "Stdcall Calling Convention" section: "...@nn is always added at the end of the Link_Name by the compiler." I didn't realize at that moment that the exported name and the DLL's entry point name generally need not be the same, and that the tool that creates an import library may take care of it. The term "Link_Name" somehow hypnotizes me, and I gave up. I think that a reference to the gnatdll at that point of documentation would save from such a mistake. Therefore I just sent to report@gnat.com the following suggestion: ============================================================================== I suggest a minor addition to the GNAT User's Guide. Taking the GNAT User's Guide for GNAT 3.13p as a base, I think that it may be useful to add the following paragraph at the end of Stdcall Calling Convention section (that is, after the words "@nn is always added at the end of the Link_Name by the compiler.") . --- cut here --- Note, that in some special cases a DLL's entry point name lacks a trailing @nn. while the exported name generated for a call has it. The gnatdll tool, which creates the import library for the DLL, is able to handle those cases (see the description of the switches in Using gnatdll section). --- cut here --- ============================================================================== Alexander Kopilovitch aek@vib.usr.pu.ru Saint-Petersburg Russia