Created
November 17, 2015 21:57
-
-
Save fero23/fb47c02cca0d20931b97 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Runtime.InteropServices; | |
using System.Windows.Forms; | |
namespace HSTest | |
{ | |
public partial class Form1 : Form | |
{ | |
public Form1() | |
{ | |
InitializeComponent(); | |
hs_init(IntPtr.Zero, IntPtr.Zero); | |
} | |
[DllImport("formatter.so", CallingConvention = CallingConvention.Cdecl)] | |
private static extern void hs_init(IntPtr argc, IntPtr argv); | |
[DllImport("formatter.so", CallingConvention = CallingConvention.Cdecl)] | |
private static extern void hs_exit(); | |
[DllImport("formatter.so", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] | |
private static extern IntPtr format(string original); | |
private void button1_Click(object sender, EventArgs e) | |
{ | |
textBox2.Text = Marshal.PtrToStringAnsi(format(textBox1.Text)); | |
} | |
private void Form1_FormClosing(object sender, FormClosingEventArgs e) | |
{ | |
hs_exit(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment