Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Pryor <jpryor@novell.com>2004-11-18 17:30:05 +0300
committerJonathan Pryor <jpryor@novell.com>2004-11-18 17:30:05 +0300
commit93468a09ecd5166238b81e4816fe6907188527c9 (patch)
tree5b78434b3d1e2bcf3b7f8af55ab4738cea22c5d6 /mcs/class/Mono.Posix
parent403f253a4a9202174dab34d40c1b3681991290bc (diff)
Remove unnecessary Console.WriteLines, comment the class.
svn path=/trunk/mcs/; revision=36271
Diffstat (limited to 'mcs/class/Mono.Posix')
-rw-r--r--mcs/class/Mono.Posix/Mono.Unix/CdeclFunction.cs31
1 files changed, 21 insertions, 10 deletions
diff --git a/mcs/class/Mono.Posix/Mono.Unix/CdeclFunction.cs b/mcs/class/Mono.Posix/Mono.Unix/CdeclFunction.cs
index bc11e813306..8059fc081f9 100644
--- a/mcs/class/Mono.Posix/Mono.Unix/CdeclFunction.cs
+++ b/mcs/class/Mono.Posix/Mono.Unix/CdeclFunction.cs
@@ -35,7 +35,26 @@ using System.Text;
namespace Mono.Unix {
- // This class is intended to be thread-safe
+ // This class represents a single unmanaged function with "cdecl" calling
+ // convention -- that is, it can accept a variable number of arguments which
+ // are passed on the runtime stack.
+ //
+ // To use, create an instance:
+ //
+ // CdeclFunction printf = new CdeclFunction ("the library",
+ // "the function name", /* optional */ typeof (ReturnType));
+ //
+ // Then call the Invoke method with the appropriate number of arguments:
+ //
+ // printf.Invoke (new object[]{"hello, %s\n", "world!"});
+ //
+ // In the background a P/Invoke definition for the method with the
+ // requested argument types will be generated and invoked, invoking the
+ // unmanaged function. The generated methods are cached, so that subsequent
+ // calls with the same argument list do not generate new code, speeding up
+ // the call sequence.
+ //
+ // This class is intended to be thread-safe.
public sealed class CdeclFunction
{
// The readonly fields (1) shouldn't be modified, and (2) should only be
@@ -56,8 +75,6 @@ namespace Mono.Unix {
public CdeclFunction (string library, string method, Type returnType)
{
- Console.WriteLine ("** construction CdeclFunction for lib [{0}], export {1}",
- library, method);
this.library = library;
this.method = method;
this.returnType = returnType;
@@ -84,12 +101,9 @@ namespace Mono.Unix {
MethodInfo mi = (MethodInfo) overloads [typeName];
if (mi != null) {
- Console.WriteLine ("** using cached MethodInfo");
return mi;
}
- Console.WriteLine ("** creating a new P/Invoke import");
- // TypeBuilder tb = ModuleBuilder.DefineType (typeName, TypeAttributes.Public);
TypeBuilder tb = CreateType (typeName);
MethodBuilder mb = tb.DefinePInvokeMethod (
method,
@@ -102,7 +116,6 @@ namespace Mono.Unix {
CharSet.Ansi);
mi = tb.CreateType ().GetMethod (method);
overloads.Add (typeName, mi);
- Console.WriteLine ("** # overloads: " + overloads.Count);
return mi;
}
}
@@ -146,9 +159,7 @@ namespace Mono.Unix {
sb.Append (") : ").Append (returnType.FullName);
- string r = sb.ToString ();
- Console.WriteLine ("** type name: " + r + "; HashCode=" + r.GetHashCode());
- return r;
+ return sb.ToString ();
}
private static Type[] GetParameterTypes (object[] parameters)