Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save automatonic/3778393 to your computer and use it in GitHub Desktop.
Save automatonic/3778393 to your computer and use it in GitHub Desktop.
SWIGing to C#: Inject "using" statement(s)
//Into Intermediate (P/Invoke) Class
%pragma(csharp) imclassimports=%{
using System;
using System.Runtime.InteropServices;
//The above are in the default version, additions follow:
using System.Collections.Generic;
using Some.Other.Namespace;
%}
//Into Generated Module Class (for globals, etc.)
%pragma(csharp) moduleimports=%{
using System;
using System.Runtime.InteropServices;
//The above are in the default version, additions follow:
using System.Collections.Generic;
using Some.Other.Namespace;
%}
//Into each generated C# Wrapper class
%typemap(csimports) SWIGTYPE %{
using System;
using System.Runtime.InteropServices;
//The above are in the default version, additions follow:
using System.Collections.Generic;
using Some.Other.Namespace;
%}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment