NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

TypeBuilder.DefinePInvokeMethod (String, String, String, MethodAttributes, CallingConventions, Type, Type[], PInvokeMap)

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;

Parameters

name
The name of the PInvoke method.
dllName
[To be supplied.]
entryName
[To be supplied.]
attributes
[To be supplied.]
callingConvention
[To be supplied.]
returnType
[To be supplied.]
parameterTypes
[To be supplied.]
linkFlags
[To be supplied.]

Return Value

The defined PInvoke method.

Exceptions

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

Requirements

NGWS Runtime Security:

ReflectionPermission SecurityAction.Demand, ReflectionEmit

See Also

TypeBuilder Class | TypeBuilder Members | System.Reflection.Emit Namespace | TypeBuilder.DefinePInvokeMethod Overload List