There are *lots* of ways to integrate programming languages. You picked one of the toughest ways.
To call code written in one programming language from code written in another programming language, you have to know the following things:
1. How does each language lay out their stack? This one is REAL important. The stack is where many languages -- C is one of them -- look for:
a. variables that are passed to the subroutine
b. the return address in the calling program
2. Who is responsible for cleaning up the stack
3. How big are those variables on the stack? What is the bit order of each variable?
There are easier ways to solve this problem. Writing a file is one of them. Using pipes is another if your operating system supports pipes.
-Kevin