This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- FlexNet Publisher
- :
- FlexNet Publisher Forum
- :
- Re: Usage of lp_checkout() in C# code
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 21, 2006
03:55 AM
Usage of lp_checkout() in C# code
Hi
I am new to .Net and C# so if someone can guide me in the easiet way please help.
Right now, I have incorporated the lt_checkout(), lt_checkin() functionality in one of the C# code. It is working fine.
But there is a problem that using lt_checkout(), lt_checkin(), I cannot manage the handles to know how many and who all have checked out or checked in the features.
So for that I believe I need to use lp_checkout() and lp_checkin() functions in my C# code.
Now, the problem I am facing is how to declare the lp_checkout() and lp_checkin() functions in my C# code as the former takes in 1st argument of the type (LPCODE_HANDLE *) and the last argument as (LP_HANDLE *).
How to declare such arguments in C# so that the code knows what LP_HANDLE and LPCODE_HANDLE is?
To be more easy and clear....right now I am using this code in a .cs file
[DllImport("lmgr10.dll", CharSet=CharSet.Ansi)]
public static extern int lt_checkout(int iPolicy, String FeatureName, String FeatureVersion, String LicPath);
[DllImport("lmgr10.dll", CharSet=CharSet.Ansi)]
public static extern void lt_checkin();
Now I want to use
lp_checkout(LPCODE, policy, feature, version, num_lic,
license_file_list, &lp_handle)
in which LPCODE is of type (LPCODE_HANDLE *) and &lp_handle is of type (LP_HANDLE *).
How do I make such declaration and how will C# code know what LPCODE_HANDLE and LP_HANDLE are?
Thanks in advance
I am new to .Net and C# so if someone can guide me in the easiet way please help.
Right now, I have incorporated the lt_checkout(), lt_checkin() functionality in one of the C# code. It is working fine.
But there is a problem that using lt_checkout(), lt_checkin(), I cannot manage the handles to know how many and who all have checked out or checked in the features.
So for that I believe I need to use lp_checkout() and lp_checkin() functions in my C# code.
Now, the problem I am facing is how to declare the lp_checkout() and lp_checkin() functions in my C# code as the former takes in 1st argument of the type (LPCODE_HANDLE *) and the last argument as (LP_HANDLE *).
How to declare such arguments in C# so that the code knows what LP_HANDLE and LPCODE_HANDLE is?
To be more easy and clear....right now I am using this code in a .cs file
[DllImport("lmgr10.dll", CharSet=CharSet.Ansi)]
public static extern int lt_checkout(int iPolicy, String FeatureName, String FeatureVersion, String LicPath);
[DllImport("lmgr10.dll", CharSet=CharSet.Ansi)]
public static extern void lt_checkin();
Now I want to use
lp_checkout(LPCODE, policy, feature, version, num_lic,
license_file_list, &lp_handle)
in which LPCODE is of type (LPCODE_HANDLE *) and &lp_handle is of type (LP_HANDLE *).
How do I make such declaration and how will C# code know what LPCODE_HANDLE and LP_HANDLE are?
Thanks in advance
(3) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 28, 2006
01:26 PM
AFAIK it is not possible to make C# aware of the structure defined in the C header. You would have to redefine these structs in your C# application in C# syntax. The only problem is that after you define a struct (for ex. _lpcode_handle or _lp_handle) there are other pointers to structs inside these structs, so you will have to define those too in C#. I'm not sure how many of these structures you will have to define but it seems to be the only solution if you have to use the Simple API, otherwise change to Trivial or even better Flexible. If you try the above let us know of the results.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 28, 2006
10:04 PM
Yeah I know...its a mammoth task to keep on redifing all the internal structures. It is actually a recreation of the whole C header file in C# terminology.
I figured that out but was just looking for a direct simple solution "I thought Macrovision might have some straight way of doing it".
Anyway thanks for your guidance.
I'm using the Trivial API at this moment. If I use a Flexible API, I again land in the same problem of redefining the header file in C# syntax as its first argument is a pointer to LM_HANDLE structure which itself is a cluster of nested structures and pointer to structures (pointer to LM_HANDLE is the last aargument of Simple API).
So the problem remains the same 🙂
I figured that out but was just looking for a direct simple solution "I thought Macrovision might have some straight way of doing it".
Anyway thanks for your guidance.
I'm using the Trivial API at this moment. If I use a Flexible API, I again land in the same problem of redefining the header file in C# syntax as its first argument is a pointer to LM_HANDLE structure which itself is a cluster of nested structures and pointer to structures (pointer to LM_HANDLE is the last aargument of Simple API).
So the problem remains the same 🙂
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 29, 2006
12:30 PM
Yes, that's correct! You will be faced with the same issue with the Flexible API. However if you go through the effort of writing the header for C# might want to consider using the Flexible API for the functionality it offers and also sometime in the future the other two APIs might be deprecated.
![](/skins/images/D60DF682EA37BF37032955CE10F3F0BB/responsive_peak/images/icon_anonymous_message.png)