No replies
2 Posts

Pinned topic Calling Ada from C code

‏2012-02-01T13:54:40Z |

I'm using rational apex version Apex 4.2.0b, Ada95. We are doing embedded development, our target processor is a PPC. We're using VxWorks version 5.4.2 and the ccppc compiler and ldppc linker for our C code.

I would like to have C code call Ada code. So far, in my Ada code, I've exported the Ada functions I'd like to call using "pragma Export".

In my C code, I declare the Ada functions as extern, using the C names that I assigned to them in the pragma Export.

In a separate Ada package, I import the C function using "pragma import". From a dummy Ada main, I call the C code. The C code calls the exported Ada functions.

Everything compiles and links without problem.

The problem I'm having is that there are calls being made to the Ada.Calendar "Clock" function that are freezing the rack on which the combined code is running. This doesn't happen right away, but after a few calls are made to the Clock function.

Any ideas on how I should set things up?