https://github.com/Kitware/CMake
Raw File
Tip revision: b61fe6a831c72050c3a4f830445f98696b0cedf7 authored by Brad King on 14 June 2021, 15:05:49 UTC
CMake 3.20.4
Tip revision: b61fe6a
cppCLI.cxx
#include <stdio.h>

#ifdef __cplusplus_cli
#  include <msclr\marshal_cppstd.h>

void cliFunction()
{
  System::String ^ result = "cliFunction";
  result = result->Trim();
  printf(msclr::interop::marshal_as<std::string>(result).c_str());
}
#else
void cliFunction()
{
  printf("cliFunction (but /cli was not passed to the compiler)");
}
#endif

void nonCliFunction()
{
  printf("nonCliFunction");
}
back to top