Hi Guys,
Is it possbile to place 'defines / macros' inside a .lib file to hide the definitions from people?
Thanks in advance :)
Hi Guys,
Is it possbile to place 'defines / macros' inside a .lib file to hide the definitions from people?
Thanks in advance :)
I think there are two basic approaches you can use consistently to achieve this.
Approach 1. If you are ok with using extern variables, then you can simply declare them in the header file and define their value once in some cpp file. These are usually better for debugging than defines.
Approach 2. If you must have your macros/defines as preprocessor directives, you can create two sets of header files. A set of "Private" header files that are only used during your library compilation but not available to external SDK users. This is tricky and requires more work but it works.
Is it possbile to place 'defines / macros' inside a .lib file to hide the definitions from people?
Have you considered using something like the Pimpl idiom to hide your implementations? It is a bit more complex than just creating the base functionality, but if you choose a few main classes to obscure with it, then it can be quite effective.
if you choose a few main classes to obscure with it, then it can be quite effective.
No, not more effective at all against "prying eyes". Someone who wants to reverse engineer a product can recognize and break it easily. All it does is add a trivial wrapper. Pimpl is useful to help reduce compile times, but does not add any security or obscurity. The functionality is still paired with a descriptive name, it simply has to go through an easily identified pointer first.
I think reverse engineering goes beyond the scope of the original question, but I will say that obfuscators are not as effective as one might hope they would be.
Case in point: some years ago I was lead engineer on a Java-based software product (not a game) where we used an obfuscator to protect our valuable intellectual property. We had a single client who had paid many hundreds of thousands of dollars for this piece of software and if they wanted a new feature all they needed to do would have been to ask. Even so, they apparently felt it was more cost effective to reverse engineer our code so they could insert about 10 extra instructions. Every time we sent them a new release they would have to reverse engineer the program all over again because we had configured the obfuscator to use a new random seed with every build. We finally caught them at it when they filed a bug with a stack trace that I *knew* could not possibly have been generated by our code.
It says something about how (in)effective obfuscators are when it's easier to disassemble Java bytecode than it is to send an e-mail that says "Pretty please add feature X" (when that feature would take literally two lines of code).
No, not more effective at all against "prying eyes". Someone who wants to reverse engineer a product can recognize and break it easily. All it does is add a trivial wrapper. Pimpl is useful to help reduce compile times, but does not add any security or obscurity. The functionality is still paired with a descriptive name, it simply has to go through an easily identified pointer first.if you choose a few main classes to obscure with it, then it can be quite effective.