# Ffi pack: C99 bool processing

**URL:** <https://swi-prolog.discourse.group/t/ffi-pack-c99-bool-processing/3955>\
**Category:** General\
**Created:** [May 14, 2021, 7:17pm UTC](https://swi-prolog.discourse.group/t/ffi-pack-c99-bool-processing/3955 "2021-05-14T19:17:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![swi](https://avatars.discourse-cdn.com/v4/letter/s/51bf81/32.png) [@swi](https://swi-prolog.discourse.group/u/swi)\
**Post date:** [May 14, 2021, 7:17pm UTC](https://swi-prolog.discourse.group/t/ffi-pack-c99-bool-processing/3955/1 "2021-05-14T19:17:20Z")

</div>

What should be used for the C99 bool type? I tried the following but it fails:

C declaration:

```prolog
bool Filter_Max_uint8 (uint8_t response[], const uint8_t data[], size_t temp[], size_t size, size_t order);

```

Prolog:

```prolog
:- c_import("#include \"Filter.h\"", % ffi:cpp_hook provides -I flag
            [linasm(lib/'liblinasm.so')],
	    [
	      'Filter_Max_uint8'( *int, % uint8_t response[],
	                           *int, % const uint8_t data[],
				               *int, % size_t temp[],
				               int, % size_t size,
				               int, % size_t order,
			                   [int])
	    ]).

```

The error is:

```prolog
ERROR: /tmp/prolog/linasm/filter.pl:11:
ERROR: FFI: 'Filter_Max_uint8': incompatible return type: int <- '_Bool'

```

---

<div class="post-metadata">

**Author:** ![swi](https://avatars.discourse-cdn.com/v4/letter/s/51bf81/32.png) [@swi](https://swi-prolog.discourse.group/u/swi)\
**Post date:** [May 19, 2021, 6:07pm UTC](https://swi-prolog.discourse.group/t/ffi-pack-c99-bool-processing/3955/2 "2021-05-19T18:07:40Z")

</div>

For those that stumble upon this thread, this is fixed in the latest version of the ffi pack.
