I read the post:
combining c with c++ code
This shows how to call from C++ to C, but it didn't discuss how to call from C to C++ which is what I'm really needing to do.
Does anybody have any advice on how to do this?
Thanks,
Mike
I read the post:
combining c with c++ code
This shows how to call from C++ to C, but it didn't discuss how to call from C to C++ which is what I'm really needing to do.
Does anybody have any advice on how to do this?
Thanks,
Mike
NEVER PET YOUR DOG WHILE IT'S ON FIRE!
I don't think there's a way to do it in the C code.
Perhaps you can make a .dll and reference it?
[32] How to mix C and C++, C++ FAQ Lite
It needs to start off as a C++ program, then you can wander between the two as much as you like.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
The C program is a server that is resident on a device. It's static and starts up when the device does. The C++ application is the open source OSS browser. It gets loaded dynamically in the device at run time (it's a DLL). Does that mean it's pretty much impossible or can I define an API in that case? If so, I've never defined an API before and might need some pointers on how to do that.
Thanks!
Mike
NEVER PET YOUR DOG WHILE IT'S ON FIRE!
Can't you "exec" your browser?
Why does it need to be a DLL?
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Salem,
It's all embedded code. I'm not all that certain I understand what you mean by "exec" the browser. I suspect you are suggesting that I start the browser from the C code. I cannot do that. I'd get fired!
This device is a retail product.
Thanks!
Mike
NEVER PET YOUR DOG WHILE IT'S ON FIRE!
Sure you won't get fired discussing it on open forums?
Do you just need to call C++ stand-alone functions, or do you need to create objects and call member functions?
Why not write some wrapper functions in C++ that call the C++ code and export those functions as extern "C" so your C program can call your wrapper functions?
"I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008
"the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010
Thanks cpjust. I may do just that despite having been discouraged from this approach by our architects. I'm being "encouraged" to use function pointers instead.
FYI: As a test engineer who knows just enough C to be dangerous, I've been elected to implement some test hooks into our code. Hence, working with advanced topics in C++ all the while being a C++ noob. It's been quite a vertical learning curve.
NEVER PET YOUR DOG WHILE IT'S ON FIRE!