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=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.13.214.202 with SMTP id y193mr3208627ywd.19.1468353005311; Tue, 12 Jul 2016 12:50:05 -0700 (PDT) X-Received: by 10.157.16.85 with SMTP id o21mr128025oto.0.1468353005109; Tue, 12 Jul 2016 12:50:05 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!au2pb.net!weretis.net!feeder6.news.weretis.net!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!hy1no124095igb.0!news-out.google.com!d130ni692ith.0!nntp.google.com!hy1no124093igb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 12 Jul 2016 12:50:05 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=69.158.110.180; posting-account=gOYTTAoAAADrNEg_oe5Etelo-0qd7UeW NNTP-Posting-Host: 69.158.110.180 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Application Crashes when linked with DLL From: Aurele Injection-Date: Tue, 12 Jul 2016 19:50:05 +0000 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:31078 Date: 2016-07-12T12:50:05-07:00 List-Id: Hi o/, I'm working with Gautier and we stumbled on an interesting program b= ehavior and thought of sharing it with you for comments. We are using the l= atest version (2016) of Adacore GNAT programming studio. Here is the proble= m: =20 Create a dynamic link library (DLL) and link it to an separate application.= The application crashes with the message "This application as requested th= e runtime to terminate in an unusual way. Specifically, the problem is caus= ed by the exception block in the application. Remove it and all is well. -- ****************************************************************** -- -- The DLL (Dynamic Link Library) -- ****************************************************************** -- package Dll_Name is procedure DLL_Test_Procedure( s : Integer :=3D 0 ); private pragma export( Ada, DLL_Test_Procedure, "DLL_Test_Procedure" ); end Dll_Name; with Ada.Text_IO; package body Dll_Name is procedure DLL_Test_Procedure( s : Integer :=3D 0 ) is Item : String (1 .. 80); Last : Natural; begin Ada.Text_IO.Put( "Hello World from 'DLL_Test_Procedure'... : " ); Ada.Text_IO.Put_Line( Integer'image( s ) ); Ada.Text_IO.Get_Line( Item, Last ); end DLL_Test_Procedure; end Dll_Name; -- The Import Spec (used by the application) package Dll_Name_Imports is procedure DLL_Test_Procedure( s : Integer :=3D 0 ); private pragma import( Ada, DLL_Test_Procedure, "DLL_Test_Procedure" ); end Dll_Name_Imports; -- ****************************************************************** -- -- The Application -- ****************************************************************** -- with Ada.Text_IO; with Ada.Exceptions; use Ada.Exceptions; with Dll_Name_Imports; procedure Dll_Name_Tester is procedure Trace( s: String ) is begin Ada.Text_IO.Put_Line( Ada.Text_IO.Current_Error, s ); end Trace; begin -- Problem block (if removed everything works fine) declare Constraint_Error : exception; begin raise Constraint_Error with "Exception caught."; exception when Fail : Constraint_Error =3D> Trace( Exception_Message ( Fail ) ); end; --=20 Dll_Name_Imports.DLL_Test_Procedure( 1955 ); -- This normally works fine end Dll_Name_Tester; -- ****************************************************************** -- The application (and the exception) work fine if its not linked with the DL= L. So I'm stumped !