Defines a PInvoke method given its name, the name of the DLL in which the method is defined, the attributes of the method, the calling convention of the method, the return type of the method, the types of the parameters of the method, and the PInvoke flags.
[Visual Basic] Overloads Public Function DefinePInvokeMethod( _ ByVal name As String, _ ByVal dllName As String, _ ByVal entryName As String, _ ByVal attributes As MethodAttributes, _ ByVal callingConvention As CallingConventions, _ ByVal returnType As Type, _ ByVal parameterTypes() As Type, _ ByVal linkFlags As PInvokeMap _ ) As MethodBuilder [C#] public MethodBuilder DefinePInvokeMethod( string name, string dllName, string entryName, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, PInvokeMap linkFlags ); [C++] public: MethodBuilder* DefinePInvokeMethod( String* name, String* dllName, String* entryName, MethodAttributes attributes, CallingConventions callingConvention, Type* returnType, Type* parameterTypes[], PInvokeMap linkFlags ); [JScript] public function DefinePInvokeMethod( name : String, dllName : String, entryName : String, attributes : MethodAttributes, callingConvention : CallingConventions, returnType : Type, parameterTypes : Type[], linkFlags : PInvokeMap ) : MethodBuilder;
The defined PInvoke method.
Exception Type | Condition |
---|---|
ArgumentException | if the method is not static or if the containing type is an interface or if the method is abstract of if the method was previously defined |
ArgumentNullException | if name or dllName is a null reference (in Visual Basic Nothing) |
InvalidOperationException | if the containing type has been previously created using CreateType |
NGWS Runtime Security:
ReflectionPermission | SecurityAction.Demand, ReflectionEmit |
TypeBuilder Class | TypeBuilder Members | System.Reflection.Emit Namespace | TypeBuilder.DefinePInvokeMethod Overload List