C# Класс IronPython.Modules.CTypes

Provides support for interop with native code from Python code.
Показать файл Открыть проект Примеры использования класса

Private Properties

Свойство Тип Описание
Cast System.IntPtr
CheckBits int
EmitCDataCreation void
EnsureRefCountTable void
GetFieldInfo void
GetFieldsList IList
GetFunctionType CFuncPtrType
GetHandleFromObject System.IntPtr
GetMarshalTypeFromSize System.Type
IsPointer bool
MakeArrayType System.Reflection.Emit.ArrayType
MakePointer System.Reflection.Emit.PointerType
PerformModuleReload void
StringAt System.IntPtr
StructureCannotContainSelf System.Exception
ValidateArraySizes void
ValidateArraySizes void
ValidateArraySizes void
WStringAt System.IntPtr

Открытые методы

Метод Описание
@sizeof ( IronPython.Runtime.Types.PythonType type ) : int
@sizeof ( object instance ) : int
CopyComPointer ( object src, object dest ) : int
DeleteCharArrayValue ( _Array arr, object value ) : void
DeleteWCharArrayRaw ( _Array arr ) : object
DeleteWCharArrayValue ( _Array arr ) : object
FormatError ( ) : string
FormatError ( int errorCode ) : string
FreeLibrary ( BigInteger handle ) : void
FreeLibrary ( IntPtr handle ) : void
FreeLibrary ( int handle ) : void
GetCharArrayValue ( _Array arr ) : object
GetWCharArrayRaw ( _Array arr ) : object
GetWCharArrayValue ( _Array arr ) : object
LoadLibrary ( string library, [ mode ) : object
POINTER ( CodeContext context, IronPython.Runtime.Types.PythonType type ) : IronPython.Runtime.Types.PythonType

Returns a new type which represents a pointer given the existing type.

POINTER ( CodeContext context, [ name ) : IronPython.Runtime.Types.PythonType
PyObj_FromPtr ( IntPtr address ) : object

Converts an address acquired from PyObj_FromPtr or that has been marshaled as type 'O' back into an object.

PyObj_ToPtr ( object obj ) : IntPtr

Converts an object into an opaque address which can be handed out to managed code.

Py_DECREF ( object key ) : void

Decreases the ref count on an object which has been increased with Py_INCREF.

Py_INCREF ( object key ) : void

Increases the ref count on an object ensuring that it will not be collected.

SetCharArrayValue ( _Array arr, object value ) : void
SetWCharArrayRaw ( _Array arr, object value ) : void
SetWCharArrayValue ( _Array arr, object value ) : void
_buffer_info ( CData data ) : PythonTuple
_check_HRESULT ( int hresult ) : void
_unpickle ( ) : void
addressof ( CData data ) : object

returns address of C instance internal buffer. It is the callers responsibility to ensure that the provided instance will stay alive if memory in the resulting address is to be used later.

alignment ( IronPython.Runtime.Types.PythonType type ) : int

Gets the required alignment of the given type.

alignment ( object o ) : int

Gets the required alignment of an object.

byref ( CData instance, [ offset ) : object
call_cdeclfunction ( CodeContext context, BigInteger address, PythonTuple args ) : object
call_cdeclfunction ( CodeContext context, IntPtr address, PythonTuple args ) : object
call_cdeclfunction ( CodeContext context, int address, PythonTuple args ) : object
call_commethod ( ) : void
call_function ( CodeContext context, BigInteger address, PythonTuple args ) : object
call_function ( CodeContext context, IntPtr address, PythonTuple args ) : object
call_function ( CodeContext context, int address, PythonTuple args ) : object
dlopen ( string library, [ mode ) : object
get_errno ( ) : int
get_last_error ( ) : int
pointer ( CodeContext context, CData data ) : Pointer

Returns a pointer instance for the given CData

resize ( CData obj, int newSize ) : void
set_conversion_mode ( CodeContext context, string encoding, string errors ) : PythonTuple
set_errno ( ) : void
set_last_error ( int errorCode ) : void

Приватные методы

Метод Описание
Cast ( IntPtr data, IntPtr obj, IntPtr type ) : IntPtr

Implementation of our cast function. data is marshalled as a void* so it ends up as an address. obj and type are marshalled as an object so we need to unmarshal them.

CheckBits ( INativeType cdata, PythonTuple pt ) : int

Verifies that the provided bit field settings are valid for this type.

EmitCDataCreation ( INativeType type, ILGenerator method, List constantPool, int constantPoolArgument ) : void

Emits the marshalling code to create a CData object for reverse marshalling.

EnsureRefCountTable ( ) : void
GetFieldInfo ( INativeType type, object o, string &fieldName, INativeType &cdata, int &bitCount ) : void

Shared helper between struct and union for getting field info and validating it.

GetFieldsList ( object fields ) : IList

Shared helper to get the _fields_ list for struct/union and validate it.

GetFunctionType ( CodeContext context, int flags ) : CFuncPtrType
GetHandleFromObject ( object dll, string errorMsg ) : IntPtr
GetMarshalTypeFromSize ( int size ) : Type

Given a specific size returns a .NET type of the equivalent size that we can use when marshalling these values across calls.

IsPointer ( IronPython.Runtime.Types.PythonType pt ) : bool
MakeArrayType ( IronPython.Runtime.Types.PythonType type, int count ) : ArrayType
MakePointer ( CodeContext context, string name, PythonDictionary dict ) : PointerType
PerformModuleReload ( IronPython.Runtime.PythonContext context, PythonDictionary dict ) : void
StringAt ( IntPtr src, int len ) : IntPtr

Helper function for translating from memset to NT's FillMemory API.

StructureCannotContainSelf ( ) : Exception
ValidateArraySizes ( IronPython.Modules.ArrayModule array, int offset, int size ) : void
ValidateArraySizes ( System.Bytes bytes, int offset, int size ) : void
ValidateArraySizes ( int arraySize, int offset, int size ) : void
WStringAt ( IntPtr src, int len ) : IntPtr

Helper function for translating from memset to NT's FillMemory API.

Описание методов

@sizeof() публичный статический Метод

public static @sizeof ( IronPython.Runtime.Types.PythonType type ) : int
type IronPython.Runtime.Types.PythonType
Результат int

@sizeof() публичный статический Метод

public static @sizeof ( object instance ) : int
instance object
Результат int

CopyComPointer() публичный статический Метод

public static CopyComPointer ( object src, object dest ) : int
src object
dest object
Результат int

DeleteCharArrayValue() публичный статический Метод

public static DeleteCharArrayValue ( _Array arr, object value ) : void
arr _Array
value object
Результат void

DeleteWCharArrayRaw() публичный статический Метод

public static DeleteWCharArrayRaw ( _Array arr ) : object
arr _Array
Результат object

DeleteWCharArrayValue() публичный статический Метод

public static DeleteWCharArrayValue ( _Array arr ) : object
arr _Array
Результат object

FormatError() публичный статический Метод

public static FormatError ( ) : string
Результат string

FormatError() публичный статический Метод

public static FormatError ( int errorCode ) : string
errorCode int
Результат string

FreeLibrary() публичный статический Метод

public static FreeLibrary ( BigInteger handle ) : void
handle Microsoft.Scripting.Math.BigInteger
Результат void

FreeLibrary() публичный статический Метод

public static FreeLibrary ( IntPtr handle ) : void
handle System.IntPtr
Результат void

FreeLibrary() публичный статический Метод

public static FreeLibrary ( int handle ) : void
handle int
Результат void

GetCharArrayValue() публичный статический Метод

public static GetCharArrayValue ( _Array arr ) : object
arr _Array
Результат object

GetWCharArrayRaw() публичный статический Метод

public static GetWCharArrayRaw ( _Array arr ) : object
arr _Array
Результат object

GetWCharArrayValue() публичный статический Метод

public static GetWCharArrayValue ( _Array arr ) : object
arr _Array
Результат object

LoadLibrary() публичный статический Метод

public static LoadLibrary ( string library, [ mode ) : object
library string
mode [
Результат object

POINTER() публичный статический Метод

Returns a new type which represents a pointer given the existing type.
public static POINTER ( CodeContext context, IronPython.Runtime.Types.PythonType type ) : IronPython.Runtime.Types.PythonType
context CodeContext
type IronPython.Runtime.Types.PythonType
Результат IronPython.Runtime.Types.PythonType

POINTER() публичный статический Метод

public static POINTER ( CodeContext context, [ name ) : IronPython.Runtime.Types.PythonType
context CodeContext
name [
Результат IronPython.Runtime.Types.PythonType

PyObj_FromPtr() публичный статический Метод

Converts an address acquired from PyObj_FromPtr or that has been marshaled as type 'O' back into an object.
public static PyObj_FromPtr ( IntPtr address ) : object
address System.IntPtr
Результат object

PyObj_ToPtr() публичный статический Метод

Converts an object into an opaque address which can be handed out to managed code.
public static PyObj_ToPtr ( object obj ) : IntPtr
obj object
Результат System.IntPtr

Py_DECREF() публичный статический Метод

Decreases the ref count on an object which has been increased with Py_INCREF.
public static Py_DECREF ( object key ) : void
key object
Результат void

Py_INCREF() публичный статический Метод

Increases the ref count on an object ensuring that it will not be collected.
public static Py_INCREF ( object key ) : void
key object
Результат void

SetCharArrayValue() публичный статический Метод

public static SetCharArrayValue ( _Array arr, object value ) : void
arr _Array
value object
Результат void

SetWCharArrayRaw() публичный статический Метод

public static SetWCharArrayRaw ( _Array arr, object value ) : void
arr _Array
value object
Результат void

SetWCharArrayValue() публичный статический Метод

public static SetWCharArrayValue ( _Array arr, object value ) : void
arr _Array
value object
Результат void

_buffer_info() публичный статический Метод

public static _buffer_info ( CData data ) : PythonTuple
data CData
Результат PythonTuple

_check_HRESULT() публичный статический Метод

public static _check_HRESULT ( int hresult ) : void
hresult int
Результат void

_unpickle() публичный статический Метод

public static _unpickle ( ) : void
Результат void

addressof() публичный статический Метод

returns address of C instance internal buffer. It is the callers responsibility to ensure that the provided instance will stay alive if memory in the resulting address is to be used later.
public static addressof ( CData data ) : object
data CData
Результат object

alignment() публичный статический Метод

Gets the required alignment of the given type.
public static alignment ( IronPython.Runtime.Types.PythonType type ) : int
type IronPython.Runtime.Types.PythonType
Результат int

alignment() публичный статический Метод

Gets the required alignment of an object.
public static alignment ( object o ) : int
o object
Результат int

byref() публичный статический Метод

public static byref ( CData instance, [ offset ) : object
instance CData
offset [
Результат object

call_cdeclfunction() публичный статический Метод

public static call_cdeclfunction ( CodeContext context, BigInteger address, PythonTuple args ) : object
context CodeContext
address Microsoft.Scripting.Math.BigInteger
args PythonTuple
Результат object

call_cdeclfunction() публичный статический Метод

public static call_cdeclfunction ( CodeContext context, IntPtr address, PythonTuple args ) : object
context CodeContext
address System.IntPtr
args PythonTuple
Результат object

call_cdeclfunction() публичный статический Метод

public static call_cdeclfunction ( CodeContext context, int address, PythonTuple args ) : object
context CodeContext
address int
args PythonTuple
Результат object

call_commethod() публичный статический Метод

public static call_commethod ( ) : void
Результат void

call_function() публичный статический Метод

public static call_function ( CodeContext context, BigInteger address, PythonTuple args ) : object
context CodeContext
address Microsoft.Scripting.Math.BigInteger
args PythonTuple
Результат object

call_function() публичный статический Метод

public static call_function ( CodeContext context, IntPtr address, PythonTuple args ) : object
context CodeContext
address System.IntPtr
args PythonTuple
Результат object

call_function() публичный статический Метод

public static call_function ( CodeContext context, int address, PythonTuple args ) : object
context CodeContext
address int
args PythonTuple
Результат object

dlopen() публичный статический Метод

public static dlopen ( string library, [ mode ) : object
library string
mode [
Результат object

get_errno() публичный статический Метод

public static get_errno ( ) : int
Результат int

get_last_error() публичный статический Метод

public static get_last_error ( ) : int
Результат int

pointer() публичный статический Метод

Returns a pointer instance for the given CData
public static pointer ( CodeContext context, CData data ) : Pointer
context CodeContext
data CData
Результат System.Reflection.Pointer

resize() публичный статический Метод

public static resize ( CData obj, int newSize ) : void
obj CData
newSize int
Результат void

set_conversion_mode() публичный статический Метод

public static set_conversion_mode ( CodeContext context, string encoding, string errors ) : PythonTuple
context CodeContext
encoding string
errors string
Результат PythonTuple

set_errno() публичный статический Метод

public static set_errno ( ) : void
Результат void

set_last_error() публичный статический Метод

public static set_last_error ( int errorCode ) : void
errorCode int
Результат void