To comment on the following update, log in, then open the issue: http://www.openoffice.org/issues/show_bug.cgi?id=115795 Issue #|115795 Summary|basic: specify how to pass strings as any to declared |subroutines Component|framework Version|DEV300m94 Platform|All URL| OS/Version|All Status|NEW Status whiteboard| Keywords| Resolution| Issue type|DEFECT Priority|P3 Subcomponent|code Assigned to|ab Reported by|sb
------- Additional comments from s...@openoffice.org Fri Nov 26 12:37:47 +0000 2010 ------- Issue 115716 brings up the following problem: Given Declare Function RegSetValueExTest Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long '... Dim sValue As String sValue = "THIS IS A TEST" '... RegSetValueExTest(hKey, "OOo_TEST_DATA", 0&, REG_SZ, sValue, Len(sValue)) how shall the string value sValue be marshaled as the lpData parameter of type "Any"? First interpretation: Since the lpData parameter is implicitly declared as "ByRef" (as there is no explicit "ByVal"), the string is marshaled as a reference to a string, i.e., on the stack is a pointer to a pointer to character data (char **). This is how the current (DEV300_m94) implementation behaves. The old (OOo 3.2) implementation erroneously(?) always passed ByRef string values the same way as ByVal string values (on the stack is a pointer to character data -- char *). So, in OOo 3.2 the above code (see issue 115716 for the complete test code) happened to correctly pass "THIS IS A TEST" to RegSetValueExA, while it now passes garbage. Under this interpretation, the above test code would be wrong, would have worked in OOo 3.2 by coincidence, and would need to be fixed by explicitly marking the lpData parameter as "ByVal". Second interpretation: The lpData parameter is "ByRef", so that actual values of, say, integer type would indeed be passed by address. However, as a special case, actual values of string type should not be passed as ByRef strings (i.e., as char **), but as ByVal strings (i.e., as char *). Under this interpretation, the above test code is right, and the current implementation needs to be fixed to handle that special case correctly. It needs to be specified which interpretation to chose, and, in case of the second, the code needs to be fixed. --------------------------------------------------------------------- Please do not reply to this automatically generated notification from Issue Tracker. Please log onto the website and enter your comments. http://qa.openoffice.org/issue_handling/project_issues.html#notification --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@framework.openoffice.org For additional commands, e-mail: issues-h...@framework.openoffice.org --------------------------------------------------------------------- To unsubscribe, e-mail: allbugs-unsubscr...@openoffice.org For additional commands, e-mail: allbugs-h...@openoffice.org