code: def build_and_run(
      compiler,
      source,
      libraries=(),
      include_dirs=(),
      library_dirs=(),
      define_macros=None,
      extra_compile_args=(),
  ):
      with _tempdir() as temp_dir:
          fname = os.path.join(temp_dir, "a.cpp")
          with open(fname, "w") as f:
              f.write(source)
  
          objects = compiler.compile(
              [fname],
              output_dir=temp_dir,
              include_dirs=include_dirs,
              macros=define_macros,
              extra_postargs=list(extra_compile_args),
          )
  
          try:
              postargs = ["/MANIFEST"] if PLATFORM_WIN32 else []
              compiler.link_executable(
                  objects,
                  os.path.join(temp_dir, "a"),
                  libraries=libraries,
                  library_dirs=library_dirs,
                  extra_postargs=postargs,
                  target_lang="c++",
              )
          except Exception as e:
              msg = "Cannot build a stub file.\nOriginal error: {0}".format(
                  e
              )
              raise Exception(msg)
  
          try:
              out = subprocess.check_output(os.path.join(temp_dir, "a"))
              return out
  
          except Exception as e:
              msg = "Cannot execute a stub file.\nOriginal error: {0}".format(
                  e
              )
              raise Exception(msg)
  
imports: import contextlib
  import os
  import re
  import shlex
  import shutil
  import subprocess
  import sys
  import tempfile
  from typing import List, Set
  import cupy_builder
  import cupy_builder.install_utils
  from cupy_builder import _environment
  from cupy_builder._context import Context
label_desc: Use image node_id 30 for calling a global function with example usage: build_and_run(compiler, source, libraries, include_dirs, library_dirs, define_macros, extra_compile_args) and returns: out