cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
cedericm
Level 2

Questions about implementing licensing functionality in C# and lc_checkin

Hello. We have an application built with C# and we want to use flexera licensing. I have read the documents and also looked at the examples provided, but I still feel confused. My main question is whether it is possible to implement licensing component in C#? Here is what I have tried so far:

  • I looked at the C# example in the folder ..\x64_n6-11.11.1.1\examples\csharp In this example, I used lp_checkin and lp_checkout methods with the dll I compiled lmgr11.dll This example works fine but when I integrate this example into our application, I get an error "No valid job", because lc_new_job method was not called by lp_checkin or lp_checkout methods. See the photos below:

error2.pngflex_example.png

  • Therefore, I decided to use lc_checkin and lc_checkout methods and I also read the document stating that I should also call other methods such as lc_set_attr before calling lc_checkout. This is all fine but lc_checkin takes struct as a parameter lc_checkin(LM_HANDLE* job, const LM_CHAR_PTR feature, int keep) and I need to duplicate all these structs in C# to be able to call lc_checkin via DllImport. This seems to me too much work and it means basically duplicating all C++ code in C#. (I may be wrong, as I am not a C++ programmer but this is what I understood from the internet.) Moreover, some of the structs used in code doesn't have a declaration in the source code we received. Hence, it is not even possible to rewrite all these structs in C#. In summary, I am looking for an easy way to call lc_checkin in my C# application via DllImport.
  • Lastly, I also had a look at FlexNetActivation C# example. I compiled lmgract.dll and FlexNetActivation demo application and ran it successfully. But when I enter our licensing server URL to this app, it doesn't connect to it. Please see the image below.demoappscreenshot.png


And this example calls FNP_checkout under the hood which is another C++ method. Why not calling lc_checkin or lc_checkout? I am getting license file not found error but it is not possible to debug the C++ call which makes my task harder.


(by the way, what is the difference between lc_checkout and lp_checout and why do we have both methods? Same question for dlls: lmgr11.dll and lmgract.dll)

0 Kudos
0 Replies