The answer to your first question is to pass across a pointer to a record of
the four integers you wish to add together in C. You should read the
"Interfaces to other languages" annex in the Ada Ref Manual. It was Annex B
for Ada 95. Don't know about 2005 or 2010. You will almost certainly find some
C interface examples in the standard GNAT libraries.
I've never done an assembly language interface so I cannot help you there. I
vaguely remember seeing an example in one of John Barnes' earlier books on Ada
- an Ada 83 version I think.
You could also ask your questions on the usenet comp.lang.ada. Its a lot more
active than this service and they get many questions similar to yours.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I just spent 15 minutes answering your question, but %^$£$@%$ Sourceforge lost
it (I really need to remember that Sourceforge doesn't work well with Safari
and tabs).
Hi :)
I'm trying to add codes in C and Assembly with ada, but I have some doubts,
such as:
working with C functions that require more than one argument, eg:
and how can I join with assembly code in Ada.
Thanks
The answer to your first question is to pass across a pointer to a record of
the four integers you wish to add together in C. You should read the
"Interfaces to other languages" annex in the Ada Ref Manual. It was Annex B
for Ada 95. Don't know about 2005 or 2010. You will almost certainly find some
C interface examples in the standard GNAT libraries.
I've never done an assembly language interface so I cannot help you there. I
vaguely remember seeing an example in one of John Barnes' earlier books on Ada
- an Ada 83 version I think.
You could also ask your questions on the usenet comp.lang.ada. Its a lot more
active than this service and they get many questions similar to yours.
I just spent 15 minutes answering your question, but %^$£$@%$ Sourceforge lost
it (I really need to remember that Sourceforge doesn't work well with Safari
and tabs).
See the GNAT User Guide for interfacing with
C and inline
assembler (at the end).
And, Paul isn't correct about needing to wrap the arguments in a record (the C
expects 4 arguments, not one!) See the ARM.
Hi bencz.
A very exotic place for this question ;-) . May I humbly suggest comp.lang.ada
for questions of this type:
http://groups.google.com/group/comp.lang.ada/topics
While the two answers you got are certainly good at comp.lang.ada you might
get even more interesting answers to you questions.
Martin