cppCLI.cxx 398 B

12345678910111213141516171819202122
  1. #include <stdio.h>
  2. #ifdef __cplusplus_cli
  3. # include <msclr\marshal_cppstd.h>
  4. void cliFunction()
  5. {
  6. System::String ^ result = "cliFunction";
  7. result = result->Trim();
  8. printf(msclr::interop::marshal_as<std::string>(result).c_str());
  9. }
  10. #else
  11. void cliFunction()
  12. {
  13. printf("cliFunction (but /cli was not passed to the compiler)");
  14. }
  15. #endif
  16. void nonCliFunction()
  17. {
  18. printf("nonCliFunction");
  19. }