comp.lang.ada
 help / color / mirror / Atom feed
* Calling Ada from C and vice versa...
@ 1993-04-14 15:02 enterpoop.mit.edu!eru.mt.luth.se!kth.se!octopus.tds.kth.se!ao
  0 siblings, 0 replies; only message in thread
From: enterpoop.mit.edu!eru.mt.luth.se!kth.se!octopus.tds.kth.se!ao @ 1993-04-14 15:02 UTC (permalink / 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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1993-04-14 15:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1993-04-14 15:02 Calling Ada from C and vice versa enterpoop.mit.edu!eru.mt.luth.se!kth.se!octopus.tds.kth.se!ao

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