Exemple #1
0
        static NanomsgSymbols()
        {
            Type thisType = typeof(NanomsgSymbols);

            for (int i = 0; ; ++i)
            {
                int value;

                var ptr = Interop.nn_symbol(i, out value);

                string symbolText = Marshal.PtrToStringAnsi(ptr);

                if (symbolText == null)
                {
                    break;
                }

                FieldInfo field = thisType.GetField(symbolText, BindingFlags.Static | BindingFlags.Public);

                if (field != null)
                {
                    field.SetValue(null, value);
                }
                else
                {
                    System.Diagnostics.Debug.Fail("Unused symbol " + symbolText);
                }
            }
        }
Exemple #2
0
 public static string Symbol(int i, out int value)
 {
     return(Marshal.PtrToStringAnsi(Interop.nn_symbol(i, out value)));
 }