Integration of standalone c++ lib with existing 'C' project

Hello Edge,
I would like to integrate the standalone c++ lib specific generated for my application, But I see most of file are in cpp/hpp externsion hence find difficult to intergtaed with exisitng embedded c project for MPC55xx controller.
Is there any way to integrated existing C project?

-Vikas

Hi @vikas, you can create a library from the C++ Lib and link to it from a C application. See https://github.com/edgeimpulse/example-standalone-inferencing-c for an example that runs on Windows/MacOS/Linux.

But if your target has a C++ compiler will be a lot easier just to use that (and keep C for the rest of the application).

You mean

  1. created C++ lib from MCU specific compiler
  2. then use this lib to integrate with existing embedded C project?
  3. make call the classifier function in appropriate module of legacy project/
  4. then compile all together to get single image

-Vikas B

Hi @vikas, that’s what we do in the example that I linked in.

  1. Compile into shared library.
  2. Link against shared library.

Hello .I want to deploy the c++ library in a bare-metal simple project for an mcu board that uses a Makefile to build and flash in the device . Can you give me some pointers on how to do ?

Hi @tiriotis, here’s a minimal example with a Makefile: https://github.com/edgeimpulse/example-standalone-inferencing should be easy to integrate.

In the integration process i imagine we will use a crosscompiler for the c and c++ files .But i dont know what Cflags i should add in the compilation for the building of the binary file.

@tiriotis: this should be it:

Few defines and a few includes. We use this on Windows/Mac/Linux/WebAssembly cross compilation.