00001 #region License
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #endregion
00027
00028 using System;
00029 using System.Collections.Generic;
00030 using System.Text;
00031 using System.Reflection;
00032
00033 namespace OpenTK.Compute.CL10
00034 {
00038 #if EXPERIMENTAL
00039 public
00040 #endif
00041 sealed partial class CL : BindingsBase
00042 {
00043 #region Fields
00044
00045 const string Library = "opencl.dll";
00046 static readonly object sync_root = new object();
00047
00048 #endregion
00049
00050 #region Constructors
00051
00052 static CL()
00053 {
00054 Type imports = typeof(CL).GetNestedType("Core", BindingFlags.Static | BindingFlags.NonPublic);
00055 FieldInfo[] delegates = typeof(CL).GetNestedType("Delegates", BindingFlags.Static | BindingFlags.NonPublic).GetFields(BindingFlags.Static | BindingFlags.NonPublic);
00056 if (delegates == null || imports == null)
00057 throw new Exception("[Internal Error] Failed to locate CL.Delegates. Please file a bug report at http://www.opentk.com/issues");
00058
00059 for (int i = 0; i < delegates.Length; i++)
00060 {
00061 MethodInfo method = imports.GetMethod(delegates[i].Name.Substring(2), BindingFlags.Static | BindingFlags.NonPublic);
00062 Delegate @new = Delegate.CreateDelegate(delegates[i].FieldType, method);
00063 delegates[i].SetValue(null, @new);
00064 }
00065 }
00066
00067 #endregion
00068
00069 #region Protected Members
00070
00074 protected override object SyncRoot
00075 {
00076 get { return sync_root; }
00077 }
00078
00091 protected override IntPtr GetAddress(string funcname)
00092 {
00093 throw new NotSupportedException();
00094
00095 }
00096
00097 #endregion
00098 }
00099 }