So if you need some raw of performance in your application what do you do? You drop down into a native development language like C. Well what if you want to code with OOP goodness and use C++. Regular calls from Java, Ruby, etc. will not get to your C++ functions because C++ adds all sorts of template madness when it exports your programs symbols.
So what do you do?
extern "C"so if your want to wrap your c++ classes in a single method called helloWorld (or MYLIB_helloWorld to not be confused with other helloWorlds!):
extern "C" MYLIB_helloWorld();in your header file.....then in your cpp file you can just do the normal
MYLIB_helloWorld();Yay! Now you can make native calls from higher level languages like java or even ruby without them getting pissed off at the c++ template symbols. Will post examples soon.
No comments:
Post a Comment