Passing Strings out of Procedures
Posted: Wed Dec 14, 2011 12:11 am
Greetings All!
I am working on a procedure that uses another companies dll to return information from their web-based database. The information is related to software licensing and activation.
Here is some base information regarding the procedure.
Sample procedure Calls for
VBasic
C/C++/Objective C
For VB.NET and C#.NET, the function returns a string with the value of <param>. (I did not include sample code for these languages since we are not working with them, I can if needed).
For all other programming environments, <value> should be a buffer of 256 bytes or greater. <value_size> should
indicate the size of buffer allocated.
If DNA_Param returns “0”, then <value> will contain the value of the <param> from the CDM.
If DNA_Param returns “1”, then a problem occurred with the DNA.DLL.
I am assuming that we fall under the "All other programming environments" and have come up with this for the procedure
I think I should be passing returnval and size in a structure instead so that I can then pull those values. However, I basically just need to have ProcedureReturn returnval and am trying to figure out a way to get the string data that is at @returnval memory. I have tried peeks() and different pointer functions but just get a large integer value. The actual data for the Param="ACTIVATION_DATE" should be a string in "MM/DD/YYYY" format.
Can anyone provide me with a clue as to how to get the actual string and return it. I know I will change the line
to
in order to return the string but I need to get Result.s to be the correct data first. Any clues or hints. I have looked at this so much for so long, I am now confusing myself and getting off track.
Thanks
Slyvnr
I am working on a procedure that uses another companies dll to return information from their web-based database. The information is related to software licensing and activation.
Here is some base information regarding the procedure.
Sample procedure Calls for
VBasic
Code: Select all
Public Function DNA_Param(ByVal param As String, ByRef value As String, ByVal value_size As
Integer) As Integer
Code: Select all
int __stdcall DNA_Param(char *param,char *value,int value_size);
For all other programming environments, <value> should be a buffer of 256 bytes or greater. <value_size> should
indicate the size of buffer allocated.
If DNA_Param returns “0”, then <value> will contain the value of the <param> from the CDM.
If DNA_Param returns “1”, then a problem occurred with the DNA.DLL.
I am assuming that we fall under the "All other programming environments" and have come up with this for the procedure
Code: Select all
Procedure DNA_Param(Param.s, returnval.s, size.i)
Result=CallFunction(DNAdll, "DNA_PARAM", @Param, @returnval, @size)
ProcedureReturn @Result
EndProcedure
Can anyone provide me with a clue as to how to get the actual string and return it. I know I will change the line
Code: Select all
Procedure DNA_Param(Param.s, returnval.s, size.i)
Code: Select all
Procedure.s DNA_Param(Param.s, returnval.s, size.i)
Thanks
Slyvnr