Skip to content
Merged
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
12 changes: 6 additions & 6 deletions docs/framework/interop/blittable-and-non-blittable-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,26 +55,26 @@ Most data types have a common representation in both managed and unmanaged memor

- One-dimensional arrays of blittable types, such as an array of integers. However, a type that contains a variable array of blittable types is not itself blittable.

- Formatted value types that contain only blittable types (and classes if they are marshaled as formatted types). For more information about formatted value types, see [Default Marshaling for Value Types](http://msdn.microsoft.com/library/4d9a876c-e05a-40ba-bd85-bd22877f984a).
- Formatted value types that contain only blittable types (and classes if they are marshaled as formatted types). For more information about formatted value types, see [Default Marshaling for Value Types](https://msdn.microsoft.com/library/4d9a876c-e05a-40ba-bd85-bd22877f984a(v=vs.100)).

Object references are not blittable. This includes an array of references to objects that are blittable by themselves. For example, you can define a structure that is blittable, but you cannot define a blittable type that contains an array of references to those structures.

As an optimization, arrays of blittable types and classes that contain only blittable members are [pinned](../../../docs/framework/interop/copying-and-pinning.md) instead of copied during marshaling. These types can appear to be marshaled as In/Out parameters when the caller and callee are in the same apartment. However, these types are actually marshaled as In parameters, and you must apply the <xref:System.Runtime.InteropServices.InAttribute> and <xref:System.Runtime.InteropServices.OutAttribute> attributes if you want to marshal the argument as an In/Out parameter.

Some managed data types require a different representation in an unmanaged environment. These non-blittable data types must be converted into a form that can be marshaled. For example, managed strings are non-blittable types because they must be converted into string objects before they can be marshaled.

The following table lists non-blittable types from the <xref:System> namespace. [Delegates](http://msdn.microsoft.com/library/d176ee76-f982-494b-b03d-92e4118896e2), which are data structures that refer to a static method or to a class instance, are also non-blittable.
The following table lists non-blittable types from the <xref:System> namespace. [Delegates](https://msdn.microsoft.com/library/d176ee76-f982-494b-b03d-92e4118896e2(v=vs.100)), which are data structures that refer to a static method or to a class instance, are also non-blittable.

|Non-blittable type|Description|
|-------------------------|-----------------|
|[System.Array](../../../docs/framework/interop/default-marshaling-for-arrays.md)|Converts to a C-style array or a `SAFEARRAY`.|
|[System.Boolean](http://msdn.microsoft.com/library/d4c00537-70f7-4ca6-8197-bfc1ec037ff9)|Converts to a 1, 2, or 4-byte value with `true` as 1 or -1.|
|[System.Char](http://msdn.microsoft.com/library/cecc87c1-075e-4cde-aa56-33d189f66feb)|Converts to a Unicode or ANSI character.|
|[System.Class](http://msdn.microsoft.com/library/fe334af5-0123-43d8-be84-26f6f023ddb6)|Converts to a class interface.|
|[System.Boolean](https://msdn.microsoft.com/library/d4c00537-70f7-4ca6-8197-bfc1ec037ff9(v=vs.100))|Converts to a 1, 2, or 4-byte value with `true` as 1 or -1.|
|[System.Char](https://msdn.microsoft.com/library/cecc87c1-075e-4cde-aa56-33d189f66feb(v=vs.100))|Converts to a Unicode or ANSI character.|
|[System.Class](https://msdn.microsoft.com/library/fe334af5-0123-43d8-be84-26f6f023ddb6(v=vs.100))|Converts to a class interface.|
|[System.Object](../../../docs/framework/interop/default-marshaling-for-objects.md)|Converts to a variant or an interface.|
|[System.Mdarray](../../../docs/framework/interop/default-marshaling-for-arrays.md)|Converts to a C-style array or a `SAFEARRAY`.|
|[System.String](../../../docs/framework/interop/default-marshaling-for-strings.md)|Converts to a string terminating in a null reference or to a BSTR.|
|[System.Valuetype](http://msdn.microsoft.com/library/4d9a876c-e05a-40ba-bd85-bd22877f984a)|Converts to a structure with a fixed memory layout.|
|[System.Valuetype](https://msdn.microsoft.com/library/4d9a876c-e05a-40ba-bd85-bd22877f984a(v=vs.100))|Converts to a structure with a fixed memory layout.|
|[System.Szarray](../../../docs/framework/interop/default-marshaling-for-arrays.md)|Converts to a C-style array or a `SAFEARRAY`.|

Class and object types are supported only by COM interop. For corresponding types in [!INCLUDE[vbprvblong](../../../includes/vbprvblong-md.md)], C#, and C++, see the [Class Library Overview](../../../docs/standard/class-library-overview.md).
Expand Down
4 changes: 2 additions & 2 deletions docs/framework/interop/compiling-an-interop-project.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ COM interop projects that reference one or more assemblies containing imported C

- Deploying interop assemblies: You can create a standard reference to an interop assembly. In this case, the interop assembly must be deployed with your application.

The differences between these two techniques are discussed in greater detail in [Using COM Types in Managed Code](http://msdn.microsoft.com/library/1a95a8ca-c8b8-4464-90b0-5ee1a1135b66).
The differences between these two techniques are discussed in greater detail in [Using COM Types in Managed Code](https://msdn.microsoft.com/library/1a95a8ca-c8b8-4464-90b0-5ee1a1135b66(v=vs.100)).

Embedding interop types with Visual Studio is demonstrated in [Walkthrough: Embedding Type Information from Microsoft Office Assemblies](http://msdn.microsoft.com/library/85b55e05-bc5e-4665-b6ae-e1ada9299fd3) and [Walkthrough: Embedding Types from Managed Assemblies](http://msdn.microsoft.com/library/b28ec92c-1867-4847-95c0-61adfe095e21).

Expand All @@ -47,7 +47,7 @@ COM interop projects that reference one or more assemblies containing imported C
## See Also
[Exposing COM Components to the .NET Framework](../../../docs/framework/interop/exposing-com-components.md)
[Language Independence and Language-Independent Components](../../../docs/standard/language-independence-and-language-independent-components.md)
[Using COM Types in Managed Code](http://msdn.microsoft.com/library/1a95a8ca-c8b8-4464-90b0-5ee1a1135b66)
[Using COM Types in Managed Code](https://msdn.microsoft.com/library/1a95a8ca-c8b8-4464-90b0-5ee1a1135b66(v=vs.100))
[Walkthrough: Embedding Type Information from Microsoft Office Assemblies](http://msdn.microsoft.com/library/85b55e05-bc5e-4665-b6ae-e1ada9299fd3)
[Walkthrough: Embedding Types from Managed Assemblies](http://msdn.microsoft.com/library/b28ec92c-1867-4847-95c0-61adfe095e21)
[Importing a Type Library as an Assembly](../../../docs/framework/interop/importing-a-type-library-as-an-assembly.md)
4 changes: 2 additions & 2 deletions docs/framework/interop/deploying-an-interop-application.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ An interop application typically includes a .NET client assembly, one or more in

- By using embedded interop types: Beginning with the [!INCLUDE[net_v40_long](../../../includes/net-v40-long-md.md)], you can instruct the compiler to embed type information from an interop assembly into your executable. The compiler embeds only the type information that your application uses. You do not have to deploy the interop assembly with your application. This is the recommended technique.

- By deploying interop assemblies: You can create a standard reference to an interop assembly. In this case, the interop assembly must be deployed with your application. If you employ this technique, and you are not using a private COM component, always reference the primary interop assembly (PIA) published by the author of the COM component you intend to incorporate in your managed code. For more information about producing and using primary interop assemblies, see [Primary Interop Assemblies](http://msdn.microsoft.com/library/b977a8be-59a0-40a0-a806-b11ffba5c080).
- By deploying interop assemblies: You can create a standard reference to an interop assembly. In this case, the interop assembly must be deployed with your application. If you employ this technique, and you are not using a private COM component, always reference the primary interop assembly (PIA) published by the author of the COM component you intend to incorporate in your managed code. For more information about producing and using primary interop assemblies, see [Primary Interop Assemblies](https://msdn.microsoft.com/library/b977a8be-59a0-40a0-a806-b11ffba5c080(v=vs.100)).

If you use embedded interop types, deployment is simple and straightforward. There is nothing special you need to do. The rest of this article describes the scenarios for deploying interop assemblies with your application.

Expand All @@ -55,5 +55,5 @@ Directory structure and registry entries for a private deployment
## See Also
[Exposing COM Components to the .NET Framework](../../../docs/framework/interop/exposing-com-components.md)
[Importing a Type Library as an Assembly](../../../docs/framework/interop/importing-a-type-library-as-an-assembly.md)
[Using COM Types in Managed Code](http://msdn.microsoft.com/library/1a95a8ca-c8b8-4464-90b0-5ee1a1135b66)
[Using COM Types in Managed Code](https://msdn.microsoft.com/library/1a95a8ca-c8b8-4464-90b0-5ee1a1135b66(v=vs.100))
[Compiling an Interop Project](../../../docs/framework/interop/compiling-an-interop-project.md)
2 changes: 1 addition & 1 deletion docs/framework/interop/exposing-com-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ This section summarizes the process needed to expose an existing COM component t

The common language runtime requires metadata for all types, including COM types. There are several ways to obtain an assembly containing COM types imported as metadata.

2. [Create COM types in managed Code](http://msdn.microsoft.com/library/1a95a8ca-c8b8-4464-90b0-5ee1a1135b66).
2. [Create COM types in managed Code](https://msdn.microsoft.com/library/1a95a8ca-c8b8-4464-90b0-5ee1a1135b66(v=vs.100)).

You can inspect COM types, activate instances, and invoke methods on the COM object the same way you do for any managed type.

Expand Down
4 changes: 2 additions & 2 deletions docs/framework/interop/exposing-dotnet-components-to-com.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ Writing a .NET type and consuming that type from unmanaged code are distinct act

COM developers can reference types in an assembly using the same tools and techniques they use today.

3. [Call a .NET object](http://msdn.microsoft.com/library/40c9626c-aea6-4bad-b8f0-c1de462efd33).
3. [Call a .NET object](https://msdn.microsoft.com/library/40c9626c-aea6-4bad-b8f0-c1de462efd33(v=vs.100)).

COM developers can call methods on the .NET object the same way they call methods on any unmanaged type. For example, the COM **CoCreateInstance** API activates .NET objects.

4. [Deploy an application for COM access](http://msdn.microsoft.com/library/fb63564c-c1b9-4655-a094-a235625882ce).
4. [Deploy an application for COM access](https://msdn.microsoft.com/library/fb63564c-c1b9-4655-a094-a235625882ce(v=vs.100)).

A strong-named assembly can be installed in the global assembly cache and requires a signature from its publisher. Assemblies that are not strong named must be installed in the application directory of the client.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ There are two ways to generate a primary interop assembly:

A dependent primary interop assembly with a version number that differs from that of the original type library is not discoverable when installed in the current directory. You must either register the dependent primary interop assembly in the Windows registry or use the **/reference** option to be sure that Tlbimp.exe finds the dependent DLL.

You can also wrap multiple versions of a type library. For instructions, see [How to: Wrap Multiple Versions of Type Libraries](http://msdn.microsoft.com/library/79eefe04-a770-4bc3-8ea2-e90ddb8ec31f).
You can also wrap multiple versions of a type library. For instructions, see [How to: Wrap Multiple Versions of Type Libraries](https://msdn.microsoft.com/library/79eefe04-a770-4bc3-8ea2-e90ddb8ec31f(v=vs.100)).

## Example
The following example imports the COM type library `LibUtil.tlb` and signs the assembly `LibUtil.dll` with a strong name using the key file `CompanyA.snk`. By omitting a specific namespace name, this example produces the default namespace, `LibUtil`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ Classes can be marshaled only by COM interop and are always marshaled as interfa
## Example
The following example registers the `CompanyA.UtilLib.dll` primary interop assembly.

```
```console
regasm CompanyA.UtilLib.dll
```

## See Also
[Programming with Primary Interop Assemblies](http://msdn.microsoft.com/library/306fa1d6-0703-4004-9e93-d0a57f1be81e)
[Locating Primary Interop Assemblies](http://msdn.microsoft.com/library/d6768e4b-cd80-414d-a4f8-05d979eb393b)
[Redistributing Primary Interop Assemblies](http://msdn.microsoft.com/library/e76384f0-d631-474c-bdbd-13884cba0265)
[Programming with Primary Interop Assemblies](https://msdn.microsoft.com/library/306fa1d6-0703-4004-9e93-d0a57f1be81e(v=vs.100))
[Locating Primary Interop Assemblies](https://msdn.microsoft.com/library/d6768e4b-cd80-414d-a4f8-05d979eb393b(v=vs.100))
[Redistributing Primary Interop Assemblies](https://msdn.microsoft.com/library/e76384f0-d631-474c-bdbd-13884cba0265(v=vs.100))
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ COM type definitions usually reside in a type library. In contrast, CLS-complian

- Using design-time-only interop assemblies: Beginning with the [!INCLUDE[net_v40_long](../../../includes/net-v40-long-md.md)], you can instruct the compiler to embed type information from the interop assembly into your executable. The compiler embeds only the type information that your application uses. You do not have to deploy the interop assembly with your application. This is the recommended technique.

- Deploying interop assemblies: You can create a standard reference to the interop assembly. In this case, the interop assembly must be deployed with your application. If you employ this technique, and you are not using a private COM component, always reference the primary interop assembly (PIA) published by the author of the COM component you intend to incorporate in your managed code. For more information about producing and using primary interop assemblies, see [Primary Interop Assemblies](http://msdn.microsoft.com/library/b977a8be-59a0-40a0-a806-b11ffba5c080).
- Deploying interop assemblies: You can create a standard reference to the interop assembly. In this case, the interop assembly must be deployed with your application. If you employ this technique, and you are not using a private COM component, always reference the primary interop assembly (PIA) published by the author of the COM component you intend to incorporate in your managed code. For more information about producing and using primary interop assemblies, see [Primary Interop Assemblies](https://msdn.microsoft.com/library/b977a8be-59a0-40a0-a806-b11ffba5c080(v=vs.100)).

When you use design-time-only interop assemblies, you can embed type information from the primary interop assembly published by the author of the COM component. However, you do not have to deploy the primary interop assembly with your application.

Expand Down Expand Up @@ -72,17 +72,17 @@ COM type definitions usually reside in a type library. In contrast, CLS-complian

- Knowledge of the type library-to-assembly conversion rules.

Writing a custom wrapper is an advanced technique. For additional information about how to generate a custom wrapper, see [Customizing Standard Wrappers](http://msdn.microsoft.com/library/c40d089b-6a3c-41b5-a20d-d760c215e49d).
Writing a custom wrapper is an advanced technique. For additional information about how to generate a custom wrapper, see [Customizing Standard Wrappers](https://msdn.microsoft.com/library/c40d089b-6a3c-41b5-a20d-d760c215e49d(v=vs.100)).

For more information about the COM interop import process, see [Type Library to Assembly Conversion Summary](http://msdn.microsoft.com/library/bf3f90c5-4770-4ab8-895c-3ba1055cc958).
For more information about the COM interop import process, see [Type Library to Assembly Conversion Summary](https://msdn.microsoft.com/library/bf3f90c5-4770-4ab8-895c-3ba1055cc958(v=vs.100)).

## See Also
<xref:System.Runtime.InteropServices.TypeLibConverter>
[Exposing COM Components to the .NET Framework](../../../docs/framework/interop/exposing-com-components.md)
[Type Library to Assembly Conversion Summary](http://msdn.microsoft.com/library/bf3f90c5-4770-4ab8-895c-3ba1055cc958)
[Type Library to Assembly Conversion Summary](https://msdn.microsoft.com/library/bf3f90c5-4770-4ab8-895c-3ba1055cc958(v=vs.100))
[Tlbimp.exe (Type Library Importer)](../../../docs/framework/tools/tlbimp-exe-type-library-importer.md)
[Customizing Standard Wrappers](http://msdn.microsoft.com/library/c40d089b-6a3c-41b5-a20d-d760c215e49d)
[Using COM Types in Managed Code](http://msdn.microsoft.com/library/1a95a8ca-c8b8-4464-90b0-5ee1a1135b66)
[Customizing Standard Wrappers](https://msdn.microsoft.com/library/c40d089b-6a3c-41b5-a20d-d760c215e49d(v=vs.100))
[Using COM Types in Managed Code](https://msdn.microsoft.com/library/1a95a8ca-c8b8-4464-90b0-5ee1a1135b66(v=vs.100))
[Compiling an Interop Project](../../../docs/framework/interop/compiling-an-interop-project.md)
[Deploying an Interop Application](../../../docs/framework/interop/deploying-an-interop-application.md)
[How to: Add References to Type Libraries](../../../docs/framework/interop/how-to-add-references-to-type-libraries.md)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ If you intend to expose types in an assembly to COM applications, consider the r
## See Also
<xref:System.Runtime.InteropServices.ComVisibleAttribute>
[Exposing .NET Framework Components to COM](../../../docs/framework/interop/exposing-dotnet-components-to-com.md)
[Introducing the Class Interface](http://msdn.microsoft.com/library/733c0dd2-12e5-46e6-8de1-39d5b25df024)
[Introducing the Class Interface](https://msdn.microsoft.com/library/733c0dd2-12e5-46e6-8de1-39d5b25df024(v=vs.100))
[Applying Interop Attributes](../../../docs/framework/interop/applying-interop-attributes.md)
[Packaging an Assembly for COM](../../../docs/framework/interop/packaging-an-assembly-for-com.md)
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

To specify a primary interop assembly in managed source code, you must apply the <xref:System.Runtime.InteropServices.GuidAttribute?displayProperty=nameWithType> and <xref:System.Runtime.InteropServices.PrimaryInteropAssemblyAttribute> to the assembly at design time. The <xref:System.Runtime.InteropServices.GuidAttribute> on the primary interop assembly identifies the LIBID of the type library and the <xref:System.Runtime.InteropServices.PrimaryInteropAssemblyAttribute> identifies the version of the particular type library for which this assembly is the primary interop assembly. The <xref:System.Runtime.InteropServices.PrimaryInteropAssemblyAttribute> can appear multiple times if the assembly is the primary interop assembly for multiple versions of the same type library.

When using the types defined in a type library, always reference the primary interop assembly for that type library, rather than reimporting or redefining the types themselves. For guidelines and procedures on how to produce or use primary interop assemblies, see [Primary Interop Assemblies](http://msdn.microsoft.com/library/b977a8be-59a0-40a0-a806-b11ffba5c080). For a detailed description of the type library importing process, see [Type Library to Assembly Conversion Summary](https://msdn.microsoft.com/library/bf3f90c5-4770-4ab8-895c-3ba1055cc958(v=vs.100)).
When using the types defined in a type library, always reference the primary interop assembly for that type library, rather than reimporting or redefining the types themselves. For guidelines and procedures on how to produce or use primary interop assemblies, see [Primary Interop Assemblies](https://msdn.microsoft.com/en-us/library/b977a8be-59a0-40a0-a806-b11ffba5c080(v=vs.100)). For a detailed description of the type library importing process, see [Type Library to Assembly Conversion Summary](https://msdn.microsoft.com/library/bf3f90c5-4770-4ab8-895c-3ba1055cc958(v=vs.100)).

]]></format>
</remarks>
Expand Down