-2

I want to ask about a problem about c/c++ compile I have project need to reuse a library wrote base on Cpp language. But I need to reuse the library in a project which work on a platform only support c language (UEFI) I want to ask :
-Is it possible to write a wrap API in C code to call all function in the Cpp library ?

-And After compiled All of these (Wrap API, CppLibrary,My Source project) by C compiler =>Will the build application is working in my platform (UEFI)? "

( Assumption than both Cpp library and My project source in compile in the same compile like (visual c 2013) )

Thank you

  • 1
    Have you searched for an answer? There seems to be many on Stackoverflow itself as well as other sites. Like [here](https://stackoverflow.com/questions/7281441/elegantly-call-c-from-c) and [here](https://isocpp.org/wiki/faq/mixing-c-and-cpp). – kaylum Sep 25 '15 at 04:13
  • Yes, I did. I spent my time to read through the second link. Sr about the first, I didn't find that. My answers for my question is Possible. But I want to confirm again with another guys there. – Truong Kevin Sep 25 '15 at 04:21
  • If you know its possible then why not just trY? – user1231232141214124 Sep 25 '15 at 04:28
  • by the ways, My question is about compile problem. Will my build application is working in my platform (only support c compile from C) with the way (Wrap C Api , Cpp Lib, C source code) – Truong Kevin Sep 25 '15 at 04:29
  • @redFIVE Yes, thank you for your concern. Because My platform will take time to setup (About 2 day). I want to make a theory checking first by confirm from an expert guy in there. And spent the time to confirm it if by myself . – Truong Kevin Sep 25 '15 at 04:34
  • It's not really clear what you are asking. It seems you are now saying the question is whether you can compile your scenario with a C only compiler (that is, avoid using a c++ compiler). The answer is no you cannot do that. – kaylum Sep 25 '15 at 04:36

1 Answers1

0

You can write a C API to wrap the C++ library, but if the C++ library can't compile and run in a UEFI environment, this won't do you any good.

gigaplex
  • 471
  • 2
  • 8