This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to use BLE stack in C++ projects



TI's BLE library is compiled with CLib, however C++ development seems to require DLib.. If CLib is selected in a C++ project,  linker complains that cstart_call_ctors is not defined..

I think a startup file in assembly  will solve the issue, but I could not find any.. 

What's your suggestion?

Regards,

  • Hi,

    The TI BLE libs (and project source) is developed in C. Perhaps someone who has successfully compiled in C++ can share their changes.

    Best wishes

  • I do know they are in C.. However, compiler wise C or C++ is not a problem.. C++ compiler gracefully uses C files. (if the headers are C++ safe. if not linker will complain)..

    The problem does not rise in compile time.. Problem comes from linker. BLE stack uses CLib.. However, IAR's C++ uses DLib.. This is one of many funny annoying obstacles I run into while using any TI code though.. :D

    BTW: TI BLE libs are closed source.. How might one have compiled in C++?
  • Ok, I fixed the problem by writing some code in assembly.. First I modified cstartup.s51 to be compiled into my own library.. Then I generated ccall_ctors.s51 which reads DIFUNCT boundaries, sets them to registers and calls __call_ctors.. I wrote __call_ctors (cppinit.c looked dirty to me) which calls constructors in two pass..

    Now I can use C++ with Clib.. I do not use any Clib, Dlib crap in my code though, so selection of library is not a problem..