Hi,

I realize that my question has no relation to Cocoa, but it's still
the place where I can get the fastest answer :)

In several places in my app I check if the user has a valid license
for my app. I'd like to make cracking the app somewhat more difficult
and rather than calling -[license isValid], I want to call
isLicenseValid(), and inline this function, so that the entire code of
this function is duplicated in the binary in each place where I make
the call to isLicenseValid().

How should I declare the function in this case?

I have made an h-file and put the body of the function there:

(LicenseValidation.h)

inline bool isLicenseValid()
{
   ...
   return isValid;
}

But when I #include this h-file into an m-file where I need it, the
compiler says "Symbol not found, _isLicenseValid referenced from ..."

So I added "static" to the declaration :

static inline bool isLicenseValid()
{
   ...
   return isValid;
}

No more errors, but I am not sure if in this case the compiler will
produce as many instances of the code as there are calls to the
function. Will it?

Thanks!

P.S. I am using a GCC compiler
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to