https://github.com/Kitware/CMake
Raw File
Tip revision: 6e9eaf209dada6be84c1ac24e641c962fd40bae2 authored by Brad King on 04 March 2022, 17:06:18 UTC
CMake 3.22.3
Tip revision: 6e9eaf2
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