This is weird because it looks the .c file is compiled as C++ (not 
requiring a cast for malloc() is perfectly fine C code, but not valid C++ 
code).

I would start looking into the build system instead of trying to "C++-ify" 
the C sources. Somehow the build system seems to treat .c files as C++ 
(maybe it always calls em++ instead of emcc? emcc should select the right 
language mode based on the file extension, while em++ forces C++ mode even 
for .c files.

As a "hack" you can also force compilation in C mode with the "-x c" 
command line option, for instance:

em++ bla.c -o bla -x c

On Monday, 5 July 2021 at 02:18:37 UTC+2 [email protected] wrote:

> Apologies if this is less of an embind question and more of a "how does 
> interop work with C and C++" question. I"m a bit inexperienced using them 
> together but in my case I'm trying to use embind, which requires bindings 
> written in C++, and the library I want to link is written in C. When I try 
> to link this library (https://github.com/korginc/volcasample) I get an 
> error about implicit pointer type conversion:
>
> ../volcasample/syro/korg_syro_volcasample.c:713:23: error: assigning to 
> 'uint8_t *' (aka 'unsigned char *') from incompatible type 'void *'
>                         psms[i].comp_buf = malloc(comp_dest_size + 
> comp_ofs);
>                                            ^
>
> I suppose I could convert the library to valid C++ with correct casting 
> but I'm hoping to avoid having to patch the source library in order to link 
> it. Is there another way? A compiler flag to allow implicit pointer type 
> casting or something like that?
>
> Thanks
> Ben
>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/2fcd3663-5863-4382-bc84-4f5728c7c962n%40googlegroups.com.

Reply via email to