Transfer of control and data between C and C#

Posted by Prithvi on Stack Overflow See other posts from Stack Overflow or by Prithvi
Published on 2010-03-24T03:33:44Z Indexed on 2010/03/24 3:43 UTC
Read the original article Hit count: 270

Filed under:

C# main program needs to call a C program GA.c This C code executes many functions and one function initialize() calls objective() function. But this objective function needs to be written in C#.This call is in a loop in the C code and the C code needs to continue execution after the return from objective() until its main is over and return control to C# main program.

C# main()
{
  //code

  call to GA in C;
  //remaining code;
}


GA in C:

Ga Main()
{

 //code
 call to initialize function();
 //remaining code
}


initialize funtion() in GA
{

 for(some condition)
 {
   //code
   call to objective(parameter) function in C#;
   //code
  }
}

How do we do this?

© Stack Overflow or respective owner

Related posts about c#