comp.lang.ada
 help / color / mirror / Atom feed
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...
Date: 14 Apr 93 15:02:07 GMT	[thread overview]
Message-ID: <1993Apr14.150207.1006@kth.se> (raw)

	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

                 reply	other threads:[~1993-04-14 15:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox