First create a static library project in the same solution and turn on Common Language Runtime support. Don't turn on CLR support for the EXE project.
Add a class to the library project(.h + .cpp). Then add your necessary functions to the class and implement them only in the .cpp.
Note: You shouldn't use any .NET framework classes in .h file. For example, take a function
Let its implementation be,
Here the declaration doesn't of the method has no .NET objects as parameters. That is you can have data types like
as the parameters and not
After this, add reference to the library project in the EXE project properties. Then add the path where you've saved the header file. Then
the header file. And you can use ShowSomeMessage() method without exposing your whole EXE project source to CLR.
Note: This trick will only work in Visual C++.