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.3 required=5.0 tests=BAYES_00,INVALID_MSGID,XPRIO autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,962570a73c72dd26,start X-Google-Attributes: gid103376,public From: "Sean Parkinson" Subject: Ada code -> DLL -> C++Builder3 Date: 1999/08/29 Message-ID: <7qbftq$ntj$1@news7.svr.pol.co.uk>#1/1 X-Deja-AN: 518508284 X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211 X-Complaints-To: abuse@theplanet.net X-Trace: news7.svr.pol.co.uk 935936762 24499 62.136.81.7 (29 Aug 1999 14:26:02 GMT) Organization: Customer of Planet Online X-MSMail-Priority: Normal NNTP-Posting-Date: 29 Aug 1999 14:26:02 GMT Newsgroups: comp.lang.ada Date: 1999-08-29T14:26:02+00:00 List-Id: I have an application which is being built with C++Builder Version 3 (it is using the latest patch). This application must use some Ada code. I have an old DLL which was created by someone else using Alsys ActivAda, and a newer DLL (containing the same code) which I created using Gnat Ada95. Using the recently built DLL (from Gnat Ada95), the MS QuickView listing shows a very small code size of about 0x400h bytes, which is unfortunately too much of a small rounded figure to be realistic (it also doesn't alter with code modification). Using either the original DLL (compiled under Alsys ActivAda 83), or the Gnat Ada95version, I have performed the following... [1] Produce an import library with IMPLIB (resulting in a library file with extension .lib). [2] Produce a module definition file with IMPDEF (resulting in a definition file with extension .def). [3] Copy the X.DLL, X.DEF, and X.LIB files to the code area for the C++ (if necessary). [4] Ensure that there is a C/C++ header file with the function prototypes for the items contained within the DLL file. [5] Add the X.LIB file to the C++Builder Project. [6] Compile and link the C++Builder Project. What this has resulted in (regardless of which DLL I use), is a Windows executable which when run from the IDE, command line, or Explorer desktop, will cause an exception, or simply fail to run (the code doesn't even reach the first source line). Having traced this through with the debugger, it is my conclusion that the DLL is not being loaded into memory at a correct location - thus resulting in overwritten code or other DLL's overwritten. The cause of this seems a little vague. It will usually fail (depending upon which other libraries are being used) at the dynamic loading of the DLL in question (note that I have tried statically linking the library). I have looked through all the available options within the C++Builder environment, with no success in resolving this. An interesting point worthy of note, is that DLL's contain an "entry point", which facilitate the initialisation (or elaboration) of the function calls at runtime. Windows uses the name DllEntryPoint, whereas Ada uses a different name, ada_dll_entry. I have changed the Ada name to be the same as the Windows name, to see if that changes anything - with no success. With both the original DLL and new DLL presenting identical problems, and with them being produced by two completely different Ada compilers, I would tend to believe that this is a problem within the C++Builder V3 product package suite that either I am causing, or that C++Builder itself is causing. Has anybody got any ideas why this might be happening, as I feel that I may have missed something critical? The DLLs will work correctly, when linked and run with Ada code. Any help you may be able to provide with the above problem would be much appreciated. Regards Sean