build Scripal under Linux
build Scripal under Windows
To use Scripal with C# you need the C/C++ scripal.dll and the C# wrapper for it.
The Scripal repository contains the solution \scripal\wrapper\cs\ScripalWrapper.sln with the C# wrapper and an example project.
The ScripalWrapper.csproj project must be referenced in your own C# project and scripal.dll must be located in the execution directory.
C# example
using ScripalWrapper; // Assuming the scripal library is available as a .NET assembly with the same namespace Scripal.baseInit(Environment.CurrentDirectory); Scripal.libInit("", Scripal.ENC_UTF8); ScripalWrapper.TFScripal obj = new ScripalWrapper.TFScripal("source", "match find(bow 'a'); ifMatch matchEnd find(eow); loop;"); var result = obj.match("Find the words apple, ape and award."); Console.WriteLine("source match result: " + result + " , no. of results: " + obj.getResultSize()); for (int i = 0; i < obj.results.size(); i++) { Console.WriteLine(obj.results.text[i] + "; position:" + obj.results.positions[i][0] + "-" + obj.results.positions[i][1]); } Console.ReadKey();
For more information see matching with Scripal and library