How to set up a trial for a dynamic link library?

I'm developing a shareware sdk-like library (using C++). The library is a simple dll provides some functions. So, my first question is what types of trials are possible for simple dll? I don't want to cut the functionality of the trial dll, so I tend to use time-trial.

I roughly understand how to track usage time of the lib, so the second question is how to indicate expiration of the trial period?

There are two ideas for the present:

  1. After evaluation period expires, the library will fail to load.


  2. After evaluation period expires, the library will load successfully, but will display some kind of a nag-screen.

But both them seem quite rough, so could you please give some advices on this?


-------------Problems Reply------------

You can raise an "expired trial license" error when one calls one of your DLL function. It is more explicit and understandable by the user.


In (1) you will have to fail in DllMain() on expiration. That is not that good if your DLL was present in the import table of the program that uses your DLL.

In (2) you have more choice and it is more friendly IMHO.

Just set an internal flag on expiration and then display a nag dialog.

If the user continues to call your exported functions, you check the flag and fail all the function calls to your DLL.

Ideally, if you have an init function in your DLL, then show the expiration nag dialog when init() is called and return a special code so that the implementor knows and exists his program as well.

HTH, Elias

If I understand you correctly after the expiration period you do not want that people call the functions in the export table of your Dll.

Please note that if your Dll loads successfully people will still be able to call your Dll code even if there is a nag screen displayed. Thus you would have to guard all your exported functions by the time check.

Going for the nag screen has several drawbacks: a) Developers do not like 3rd party libraries popping up their own nagging screens. b) What if you lib is used in a non UI app (for example used in a service that does not have interact with desktop)?

In my view the best would be to allow loading of the library (for the cases your Dll is in the IAT of other modules), but have all exported functions in your interface return an error code if the trial expired. That way the application using your library can choose to ignore the functionality of your Dll or display a message that it is expired.

Hope this helps.

Category:c# Views:0 Time:2009-11-27

Related post

Copyright (C), All Rights Reserved.

processed in 0.153 (s). 11 q(s)