Re: What is the best way to define the Imported C function
- From: Adam Beneschan <adam@xxxxxxxxxx>
- Date: Mon, 28 Jan 2008 09:18:17 -0800 (PST)
On Jan 26, 5:31 pm, "Jeffrey R. Carter"
<spam.jrcarter....@xxxxxxxxxxxxxx> wrote:
I can't help you (and really, neither can those who have replied to you) because
the C specification isn't a specification; it doesn't tell us how the function
uses its parameters. Without that information, we can't tell how to interface to it.
The problem is that C uses the same construct for many conceptually different
things. For example:
void f (char* c);
may represent something that is conceptually equivalent to Ada's
procedure F (C : in Character); [unlikely, but possible]
procedure F (C : in out Character);
procedure F (C : out Character);
procedure F (C : in String);
procedure F (C : in out String);
procedure F (C : out String);
Given the common practice of using "char" to represent what Ada calls a
Storage_Element, and "char[]" or "char*" for Storage_Array, this single C
declaration may mean any of 12 different things.
It's probably worse than that, because even when char * refers to a
structure with multiple characters rather than a single character, you
don't know whether it's supposed to be a null-terminated string, or an
array of characters whose size is given somewhere else, or what.
-- Adam
.
- References:
- What is the best way to define the Imported C function
- From: qunying
- Re: What is the best way to define the Imported C function
- From: Jeffrey R. Carter
- What is the best way to define the Imported C function
- Prev by Date: Interfaces and private types
- Next by Date: Re: Interfaces and private types
- Previous by thread: Re: What is the best way to define the Imported C function
- Next by thread: Compilation without implementation source
- Index(es):
Relevant Pages
|