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
- :
- VB.NET 2.0, lc_get_attr, lc_set_attr, String Values
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
Aug 07, 2008
12:32 PM
VB.NET 2.0, lc_get_attr, lc_set_attr, String Values
I am integrating FLEXnet 11.6 into a VB.NET 2.0 code base. I have defined lc_get_attr() and lc_set_attr() as follows:
This works well for the attributes whose values are based on integers, such as LM_A_CHECK_BADDATE.
However, I am not sure that the same process is working for values based on strings. I am working particularly with LM_A_BORROW_EXPIRE. I can call lc_set_attr() with the following code:
The value of ReturnCode is 0 and the call is successful. But I am getting NULL returned from the followup call to lc_get_attr():
Here, the return code is 0, but the ExpirationDateStringPointer parameter is also 0 -- NULL, even after I have set LM_A_BORROW_EXPIRE to a value.
Has anyone done this? Can anyone offer any suggestions?
_
Private Shared Function lc_get_attr(ByVal job As IntPtr, ByVal attr As Integer, ByRef value As Short) As Int32
End Function
_
Private Shared Function lc_set_attr(ByVal job As IntPtr, ByVal key As Integer, ByVal value As IntPtr) As Int32
End Function
This works well for the attributes whose values are based on integers, such as LM_A_CHECK_BADDATE.
However, I am not sure that the same process is working for values based on strings. I am working particularly with LM_A_BORROW_EXPIRE. I can call lc_set_attr() with the following code:
ValueAsIntPtr = Marshal.StringToHGlobalAnsi(Value)
ReturnCode = lc_set_attr(thisJob, Key, ValueAsIntPtr)
The value of ReturnCode is 0 and the call is successful. But I am getting NULL returned from the followup call to lc_get_attr():
Dim ExpirationDateStringPointer As IntPtr
ReturnCode = lc_get_attr(thisJob, LM_A_BORROW_EXPIRE, ExpirationDateStringPointer)
ExpirationDateString = Marshal.PtrToStringAnsi(ExpirationDateStringPointer)
Here, the return code is 0, but the ExpirationDateStringPointer parameter is also 0 -- NULL, even after I have set LM_A_BORROW_EXPIRE to a value.
Has anyone done this? Can anyone offer any suggestions?
(1) Reply
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Aug 08, 2008
01:11 PM
I'm not very comfortable with VB.NET, but you're right about handling strings differently; from the docs for the C API (FuncRef-c.pdf), there's this note for lc_get_attr:
Types of char * are handled a little differently than other types. Types of int or short are declared, and a pointer to the declared variable is passed as an argument. Types of char * are declared as char *, and the variable itself is passed.Does any other function that works with char * (such as lc_hostid) work with similar code?