comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: .h header file in ObjectAda 8.2.2 source code?
Date: Sat, 20 Jul 2013 00:41:35 -0500
Date: 2013-07-20T00:41:35-05:00	[thread overview]
Message-ID: <ksd7uk$1dg$1@loke.gir.dk> (raw)
In-Reply-To: b42127a4-c5dc-4fd0-86cd-dd63f014897b@googlegroups.com

"dd24fan" <d3v3r4@gmail.com> wrote in message 
news:b42127a4-c5dc-4fd0-86cd-dd63f014897b@googlegroups.com...
...
> The program runs on a PC Windows environment.  It does not hang in the ada 
> main subprogram execution.
>
> I believe it to hang in the first call to the C code.

Typically, that means that there is a mistake in the specifications of the 
functions that are imported with pragma Import. As to finding the actual 
problem, usually all you can do it step through the bad call with a debugger 
and see what it is doinng wrong (sometimes you have to compare it to a call 
from C that works).

The problem with interfacing to a foreign language is that the Ada compiler 
is helpless to provide you much if any help. Only the most gross errors can 
be detected, because the Ada compiler doesn't know anything about the C code 
other than what you tell it, and if you tell it the wrong thing...

When we wer building Claw, we spent a *lot* of time debugging botched 
Imports, and we never really found a shortcut (other than triple-checking 
the imported function declarations before cracking out the debugger, 
probably half the time, the problem became evident).

Humm, you mentioned that this is on Windows. Do you know if these are 
C-convention or Stdcall-convention functions? Use the wrong one, and nothing 
will work. (Win32 is Stdcall, for instance, *not* C). For Stdcall, you need 
to get the number of parameters the same as C expects, or you will have 
problems (although those usually are an inability to link).

                          Randy.




  reply	other threads:[~2013-07-20  5:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-19 11:47 .h header file in ObjectAda 8.2.2 source code? dd24fan
2013-07-19 13:02 ` Niklas Holsti
2013-07-19 15:36 ` dd24fan
2013-07-20  5:41   ` Randy Brukardt [this message]
2013-07-22 19:06     ` dd24fan
2013-07-22 19:08     ` dd24fan
2013-07-22 20:04       ` Niklas Holsti
2013-07-23 12:05         ` dd24fan
2013-07-22 19:50     ` dd24fan
2013-07-20  8:07   ` Niklas Holsti
2013-08-01 15:03     ` Stephen Leake
replies disabled

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