[solved] [ffi] libc::types::common::c95::c_void or libc::c_void?


#1

Hi,

I’d like to use https://github.com/ctatchley/espeak-sys.
For this, I have to construct a *const *const c_void from a String to call: https://github.com/ctatchley/espeak-sys/blob/master/src/lib.rs#L155
The C header:

ESPEAK_API const char *espeak_TextToPhonemes(const void **textptr, int textmode, int phonememode);

If I use libc::c_void, I have the following error:

error[E0308]: mismatched types
  --> src/main.rs:14:43
   |
14 |         espeak_sys::espeak_TextToPhonemes(text_prt, textmode, phonememode);
   |                                           ^^^^^^^^ expected enum `libc::types::common::c95::c_void`, found enum `libc::c_void`
   |
   = note: expected type `*const *const libc::types::common::c95::c_void`
   = note:    found type `*const *const libc::c_void`

If I use libc::types::common::c95::c_void, I have this error:

error[E0432]: unresolved import `libc::types::common::c95::c_void`
 --> src/main.rs:5:5
  |
5 | use libc::types::common::c95::c_void;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Could not find `types` in `libc`

(I am working on Mac, if that matters).

Can somebody explain how I can unstuck the situation?

Thanks in advance!


#2

Are there two versions of libc involved simultaneously? It sounds like it. Ensure both use the current 0.2.x version from crates.io.


#3

My dependencies:

[dependencies]
espeak-sys = "0.0.2"
libc = "0.2"

And in espeak-sys, only libc types are used:

use libc::{c_int, c_char, c_uchar, c_void, c_short, size_t, c_uint, wchar_t, FILE};

(https://github.com/ctatchley/espeak-sys/blob/master/src/lib.rs#L20)

I don’t really understand where libc::types::common::c95::c_void is coming from.


#4

It’s depending on the old version of libc: https://github.com/ctatchley/espeak-sys/blob/master/Cargo.toml#L14


#5

oh good catch! Thx!