From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 14 Apr 93 15:02:07 GMT From: enterpoop.mit.edu!eru.mt.luth.se!kth.se!octopus.tds.kth.se!ao@ucbvax.Berk eley.EDU (Anders Ohlsson) Subject: Calling Ada from C and vice versa... Message-ID: <1993Apr14.150207.1006@kth.se> List-Id: Hi! Does anybody have a solution to this problem? I'm working on a project where multiple programs written in Ada and C send messages to each other. All parties that wish to be able to receive messages registers at the post office by calling a C function (RegisterMessageHandler) and supplies a pointer to a function, which is to be executed upon receipt of a message. I.e., when a message is sent from A to B, the post office executes B's message handler. Now, the scenario is this: 1. The post office is running as a separate server process (written in C). 2. One of the programs that receive messages is written in Ada. Everything works OK if I only manipulate LOCAL data of the message handler (written in Ada). The problem occurs when I try to manipulate GLOBAL data, e.g. append something to a linked list or print global strings... This causes my Ada system to crash with: Exception raised with improper context program aborted My compiler is Alsys Ada 5.5.1 and my machine is a SPARCstation IPX running SunOS 4.1.x. My questions is: Why can't the message handler use global data declared in the same subprogram when it is invoked by dereferencing a pointer to function in C? It seems like Ada gets confused and does not know where it's global data is anymore... Any help is greatly appreciated! Please reply by email to ao@elixir.e.kth.se Regards, Anders Ohlsson