Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CapiCodeGen.csproj make delegate caller readonly #397

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Source/Tools/GapiCodegen/Ctor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void GenerateImport (StreamWriter sw)
{
sw.WriteLine("\t\t[UnmanagedFunctionPointer (CallingConvention.Cdecl)]");
sw.WriteLine("\t\tdelegate IntPtr d_{0}({1});", CName, Parameters.ImportSignature);
sw.WriteLine("\t\tstatic d_{0} {0} = FuncLoader.LoadFunction<d_{0}>(FuncLoader.GetProcAddress(GLibrary.Load({1}), \"{0}\"));", CName, LibraryName);
sw.WriteLine("\t\tstatic readonly d_{0} {0} = FuncLoader.LoadFunction<d_{0}>(FuncLoader.GetProcAddress(GLibrary.Load({1}), \"{0}\"));", CName, LibraryName);
sw.WriteLine();
}

Expand Down
2 changes: 1 addition & 1 deletion Source/Tools/GapiCodegen/EnumGen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public override void Generate (GenerationInfo gen_info)
var funcname = Elem.GetAttribute("gtype");
sw.WriteLine ("\t\t[UnmanagedFunctionPointer (CallingConvention.Cdecl)]");
sw.WriteLine ("\t\tdelegate IntPtr d_" + funcname + "();");
sw.WriteLine ("\t\tstatic d_" + funcname + " " + funcname + " = FuncLoader.LoadFunction<d_" + funcname + ">(FuncLoader.GetProcAddress(GLibrary.Load(" + LibraryName + "), \"" + funcname + "\"));");
sw.WriteLine ("\t\tstatic readonly d_" + funcname + " " + funcname + " = FuncLoader.LoadFunction<d_" + funcname + ">(FuncLoader.GetProcAddress(GLibrary.Load(" + LibraryName + "), \"" + funcname + "\"));");
sw.WriteLine ();
sw.WriteLine ("\t\tpublic static GLib.GType GType {");
sw.WriteLine ("\t\t\tget {");
Expand Down
2 changes: 1 addition & 1 deletion Source/Tools/GapiCodegen/Method.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public void GenerateImport (StreamWriter sw)
sw.WriteLine("\t\tdelegate " + retval.CSType + " d_" + CName + "(" + import_sig + ");");
else
sw.WriteLine("\t\tdelegate " + retval.MarshalType + " d_" + CName + "(" + import_sig + ");");
sw.WriteLine("\t\tstatic d_" + CName + " " + CName + " = FuncLoader.LoadFunction<d_" + CName + ">(FuncLoader.GetProcAddress(GLibrary.Load(" + LibraryName + "), \"" + CName + "\"));");
sw.WriteLine("\t\tstatic readonly d_" + CName + " " + CName + " = FuncLoader.LoadFunction<d_" + CName + ">(FuncLoader.GetProcAddress(GLibrary.Load(" + LibraryName + "), \"" + CName + "\"));");
sw.WriteLine();
}

Expand Down
2 changes: 1 addition & 1 deletion Source/Tools/GapiCodegen/OpaqueGen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public override void Generate (GenerationInfo gen_info)
#endif
if (set_gvalue != null) {
sw.WriteLine("\t\tdelegate IntPtr d_{0}(ref GLib.Value val, IntPtr obj);", set_gvalue.CName);
sw.WriteLine("\t\tstatic d_{0} {0} = FuncLoader.LoadFunction<d_{0}>(FuncLoader.GetProcAddress(GLibrary.Load({1}), \"{0}\"));", set_gvalue.CName, LibraryName);
sw.WriteLine("\t\tstatic readonly d_{0} {0} = FuncLoader.LoadFunction<d_{0}>(FuncLoader.GetProcAddress(GLibrary.Load({1}), \"{0}\"));", set_gvalue.CName, LibraryName);
sw.WriteLine ();
sw.WriteLine ("\t\tpublic void SetGValue (ref GLib.Value val)");
sw.WriteLine ("\t\t{");
Expand Down