---
title: CloseComponent
framework: Core Services
role: symbol
role_heading: Function
platforms: [macOS 10.0+]
path: coreservices/1516436-closecomponent
---

# CloseComponent

Terminates your application’s connection to a component. 

## Declaration

```occ
OSErr CloseComponent(ComponentInstance aComponentInstance);
```

## Parameters

- `aComponentInstance`: The connection you wish to close. Your application obtains the component instance from the [doc://com.apple.documentation/documentation/coreservices/1516607-opencomponent](coreservices/1516607-opencomponent.md) function or the [doc://com.apple.documentation/documentation/coreservices/1516523-opendefaultcomponent](coreservices/1516523-opendefaultcomponent.md) function. You can use a component identifier here, but you must coerce the data type appropriately.

## Return Value

A result code. See [Result Codes](carbon_core/component_manager.md).

## Discussion

This function closes only a single connection. If your application has several connections to a single component, you must call it once for each connection. 

## See Also

### Opening and Closing Components

- [OpenAComponent](1516558-openacomponent.md)
- [OpenADefaultComponent](1516360-openadefaultcomponent.md)
- [OpenComponent](1516607-opencomponent.md)
- [OpenDefaultComponent](1516523-opendefaultcomponent.md)
