Created
November 4, 2020 08:17
-
-
Save gavinb/7d1579524337739d4f6785aa49e7cc25 to your computer and use it in GitHub Desktop.
SWIG example of defining C# property
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
/* | |
swig -csharp -c++ -namespace MyControl -outdir ..\gen MyControl.i | |
*/ | |
%module MyControl | |
%include <attribute.i> | |
%{ | |
/* Includes the header in the wrapper code */ | |
#include "..\include\MyControl.hpp" | |
%} | |
/* Parse the header file to generate wrappers */ | |
%include "..\include\MyControl.hpp" | |
/* Define a SWIG attribute which will generate a C# Property */ | |
/* Parameters: class, type, property_name, getter, setter */ | |
%attribute(MyControl, int, Level, GetLevel, SetLevel); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Then in C# you can use this as: