Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
September 14, 2003 Bug, or daft developer? | ||||
---|---|---|---|---|
| ||||
synsoft\win32\reg.d(431): function get_Value_EXPAND_SZ cannot access frame of function expand_environment_strings What does that mean? |
September 14, 2003 Re: Bug, or daft developer? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew Wilson | FYI the code looks like extern (Windows) { DWORD ExpandEnvironmentStringsA(in LPCSTR src, in LPSTR dest, in DWORD cchDest); } private char[] expand_environment_strings(in char[] value) { value ~= 0; // Ensures it's zero-terminated DWORD cchRequired = ExpandEnvironmentStringsA(value, null, 0); char[] newValue = new char[cchRequired]; ExpandEnvironmentStringsA(value, newValue, newValue.length); return newValue; } public class Value { . . . char[] get_Value_SZ() . . . char[] get_Value_EXPAND_SZ() { char[] value = get_Value_SZ(); value = expand_environment_strings(value); return value; } "Matthew Wilson" <matthew@stlsoft.org> wrote in message news:bk11u3$fha$1@digitaldaemon.com... > synsoft\win32\reg.d(431): function get_Value_EXPAND_SZ cannot access > frame of function expand_environment_strings > > What does that mean? > > |
September 14, 2003 Re: Bug, or daft developer? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew Wilson | btw, if I just put the five lines directly in get_Value_EXPAND_SZ() it all works fine "Matthew Wilson" <matthew@stlsoft.org> wrote in message news:bk15p8$lvm$1@digitaldaemon.com... > FYI the code looks like > > extern (Windows) > { > DWORD ExpandEnvironmentStringsA(in LPCSTR src, in LPSTR dest, in DWORD > cchDest); > } > > private char[] expand_environment_strings(in char[] value) > { > value ~= 0; // Ensures it's zero-terminated > > DWORD cchRequired = ExpandEnvironmentStringsA(value, null, 0); > char[] newValue = new char[cchRequired]; > > ExpandEnvironmentStringsA(value, newValue, newValue.length); > > return newValue; > } > > > public class Value > { > . . . > > char[] get_Value_SZ() > > . . . > > char[] get_Value_EXPAND_SZ() > { > char[] value = get_Value_SZ(); > > value = expand_environment_strings(value); > > return value; > } > > > > "Matthew Wilson" <matthew@stlsoft.org> wrote in message news:bk11u3$fha$1@digitaldaemon.com... > > synsoft\win32\reg.d(431): function get_Value_EXPAND_SZ cannot access > > frame of function expand_environment_strings > > > > What does that mean? > > > > > > |
September 14, 2003 Re: Bug, or daft developer? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew Wilson | I rewrote the snipped so it is self-contained: ------------------------------------ extern (Windows) { uint ExpandEnvironmentStringsA(in char* src, in char* dest, in uint cchDest); } private char[] expand_environment_strings(in char[] value) { value ~= 0; // Ensures it's zero-terminated uint cchRequired = ExpandEnvironmentStringsA(value, null, 0); char[] newValue = new char[cchRequired]; ExpandEnvironmentStringsA(value, newValue, newValue.length); return newValue; } public class Value { char[] get_Value_SZ(); char[] get_Value_EXPAND_SZ() { char[] value = get_Value_SZ(); value = expand_environment_strings(value); return value; } } ------------------------------------------------- and it compiles without error. The access frame message happens when nested functions try to access a local in a stack frame not accessible to it. |
September 14, 2003 Re: Bug, or daft developer? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | Well, then it's still a compiler bug, because none of the fns involved are nested. "Walter" <walter@digitalmars.com> wrote in message news:bk171v$nev$1@digitaldaemon.com... > > I rewrote the snipped so it is self-contained: > ------------------------------------ > > extern (Windows) > { > uint ExpandEnvironmentStringsA(in char* src, in char* dest, in uint > cchDest); > } > > private char[] expand_environment_strings(in char[] value) > { > value ~= 0; // Ensures it's zero-terminated > > uint cchRequired = ExpandEnvironmentStringsA(value, null, 0); > char[] newValue = new char[cchRequired]; > > ExpandEnvironmentStringsA(value, newValue, newValue.length); > > return newValue; > } > > public class Value > { > char[] get_Value_SZ(); > > char[] get_Value_EXPAND_SZ() > { > char[] value = get_Value_SZ(); > > value = expand_environment_strings(value); > return value; > } > } > ------------------------------------------------- > and it compiles without error. The access frame message happens when nested > functions try to access a local in a stack frame not accessible to it. > > |
September 14, 2003 Re: Bug, or daft developer? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew Wilson | I can't fix it because I can't duplicate it. "Matthew Wilson" <matthew@stlsoft.org> wrote in message news:bk1751$nhv$3@digitaldaemon.com... > Well, then it's still a compiler bug, because none of the fns involved are nested. > > "Walter" <walter@digitalmars.com> wrote in message news:bk171v$nev$1@digitaldaemon.com... > > > > I rewrote the snipped so it is self-contained: > > ------------------------------------ > > > > extern (Windows) > > { > > uint ExpandEnvironmentStringsA(in char* src, in char* dest, in uint > > cchDest); > > } > > > > private char[] expand_environment_strings(in char[] value) > > { > > value ~= 0; // Ensures it's zero-terminated > > > > uint cchRequired = ExpandEnvironmentStringsA(value, null, 0); > > char[] newValue = new char[cchRequired]; > > > > ExpandEnvironmentStringsA(value, newValue, newValue.length); > > > > return newValue; > > } > > > > public class Value > > { > > char[] get_Value_SZ(); > > > > char[] get_Value_EXPAND_SZ() > > { > > char[] value = get_Value_SZ(); > > > > value = expand_environment_strings(value); > > return value; > > } > > } > > ------------------------------------------------- > > and it compiles without error. The access frame message happens when > nested > > functions try to access a local in a stack frame not accessible to it. > > > > > > |
September 14, 2003 Re: Bug, or daft developer? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | I am content to live with the workaround for the moment. I doubt that ExpandEnvironmentStrings will remain in my Reg module for long, so I'm not going to worry about it. :) "Walter" <walter@digitalmars.com> wrote in message news:bk1ae5$rlg$1@digitaldaemon.com... > I can't fix it because I can't duplicate it. > > "Matthew Wilson" <matthew@stlsoft.org> wrote in message news:bk1751$nhv$3@digitaldaemon.com... > > Well, then it's still a compiler bug, because none of the fns involved are > > nested. > > > > "Walter" <walter@digitalmars.com> wrote in message news:bk171v$nev$1@digitaldaemon.com... > > > > > > I rewrote the snipped so it is self-contained: > > > ------------------------------------ > > > > > > extern (Windows) > > > { > > > uint ExpandEnvironmentStringsA(in char* src, in char* dest, in uint > > > cchDest); > > > } > > > > > > private char[] expand_environment_strings(in char[] value) > > > { > > > value ~= 0; // Ensures it's zero-terminated > > > > > > uint cchRequired = ExpandEnvironmentStringsA(value, null, 0); > > > char[] newValue = new char[cchRequired]; > > > > > > ExpandEnvironmentStringsA(value, newValue, newValue.length); > > > > > > return newValue; > > > } > > > > > > public class Value > > > { > > > char[] get_Value_SZ(); > > > > > > char[] get_Value_EXPAND_SZ() > > > { > > > char[] value = get_Value_SZ(); > > > > > > value = expand_environment_strings(value); > > > return value; > > > } > > > } > > > ------------------------------------------------- > > > and it compiles without error. The access frame message happens when > > nested > > > functions try to access a local in a stack frame not accessible to it. > > > > > > > > > > > > |
Copyright © 1999-2021 by the D Language Foundation