---
title: NCMGetProfileLocation
framework: Application Services
role: pseudoSymbol
platforms: []
path: applicationservices/colorsync_manager/1804889-ncmgetprofilelocation
---

# NCMGetProfileLocation

Obtains either a profile location structure for a specified profile or the size of the location structure for the profile.

## Declaration

```occ
CMError NCMGetProfileLocation (
   CMProfileRef prof,
   CMProfileLocation *theProfile,
   UInt32 *locationSize
);
```

## Parameters

- `prof`: A profile reference of type [doc://com.apple.documentation/documentation/applicationservices/cmprofileref](applicationservices/cmprofileref.md). Before calling `NCMGetProfileLocation`, you set the reference to specify the profile for which you wish to obtain the location or location structure size.
- `theProfile`: A pointer to a profile location structure, as described in [doc://com.apple.documentation/documentation/applicationservices/cmprofilelocation](applicationservices/cmprofilelocation.md). If you pass `NULL`, `NCMGetProfileLocation` returns the size of the profile location structure for the profile specified by `prof` in the `locationSize` parameter. If you instead pass a pointer to memory you have allocated for the structure, on return, the structure specifies the location of the profile specified by `prof`.
- `locationSize`: A pointer to a value of type `long`. If you pass `NULL` for the `profLoc` parameter, on return, `locationSize` contains the size in bytes of the profile location structure for the profile specified by `prof`. If you pass a pointer to a profile location structure in `profLoc`, set `locationSize` to the size of the structure before calling `NCMGetProfileLocation`, using the constant `cmCurrentProfileLocationSize`.

## Return Value

A `CMError` value. See [Result Codes](../colorsync_manager.md).

## Overview

The `NCMGetProfileLocation` function is available starting with ColorSync version 2.5. It differs from its predecessor, [CMGetProfileLocation](1804885-cmgetprofilelocation.md), in that the newer version has a parameter for the size of the location structure for the specified profile.

You should use `NCMGetProfileLocation` rather than `CMGetProfileLocation` for the following reasons:

- Code using the older version (`CMGetProfileLocation`) may not be as easily ported to other platforms.
- Specifying the size of the profile location structure ensures that it can grow, if necessary, in the future.

The best way to use `NCMGetProfileLocation` is to call it twice:

1. Pass a reference to the profile to locate in the `prof` parameter and `NULL` for the `profLoc` parameter. `NCMGetProfileLocation` returns the size of the location structure in the `locationSize` parameter.
2. Allocate enough space for a structure of the returned size, then call the function again, passing a pointer in the `profLoc` parameter; on return, the structure specifies the location of the profile.

It is possible to call `NCMGetProfileLocation` just once, using the constant `cmCurrentProfileLocationSize` for the size of the allocated profile location structure and passing the same constant for the `locationSize` parameter. The constant `cmCurrentProfileLocationSize` may change in the future, but will be consistent within the set of headers you build your application with. However, if the size of the `CMProfileLocation` structure changes in a future version of ColorSync (and the value of `cmCurrentProfileLocationSize` as well) and you do not rebuild your application, `NCMGetProfileLocation` may return an error. 

## See Also

### Accessing Profiles

- [CMOpenProfile](1804853-cmopenprofile.md)
- [CMValidateProfile](1804856-cmvalidateprofile.md)
- [CMCloseProfile](1804861-cmcloseprofile.md)
- [CMUpdateProfile](1804864-cmupdateprofile.md)
- [CMCopyProfile](1804870-cmcopyprofile.md)
- [CMProfileModified](1804872-cmprofilemodified.md)
- [CMGetProfileMD5](1804876-cmgetprofilemd5.md)
- [CMGetProfileHeader](1804879-cmgetprofileheader.md)
- [CMSetProfileHeader](1804882-cmsetprofileheader.md)
- [CMGetProfileLocation](1804885-cmgetprofilelocation.md)
- [CMCloneProfileRef](1804891-cmcloneprofileref.md)
- [CMGetProfileRefCount](1804894-cmgetprofilerefcount.md)
- [CMFlattenProfile](1804897-cmflattenprofile.md)
- [NCMUnflattenProfile](1804901-ncmunflattenprofile.md)
