Skip to content

Instantly share code, notes, and snippets.

@ChadSki
Created July 30, 2016 21:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ChadSki/e829947484c0f90346c336fd386d274a to your computer and use it in GitHub Desktop.
Save ChadSki/e829947484c0f90346c336fd386d274a to your computer and use it in GitHub Desktop.
using System;
using System.Runtime.InteropServices;
namespace CPythonBinding
{
class Program
{
[DllImport("python34.dll")]
public static extern void Py_Initialize();
[DllImport("python34.dll", CallingConvention=CallingConvention.Cdecl)]
public static extern int PyRun_SimpleString([MarshalAs(UnmanagedType.LPStr)]string toRun);
static void Main(string[] args)
{
Py_Initialize();
PyRun_SimpleString("print('yolo')");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment