El 28/12/2009 9:57, Viktor Szakáts escribió:
I'd vote for first option, as it's the only one
that allows to keep full Windows API compatibility
for WAPI_* functions. Since this is the main point
for all WAPI_* functions (and the whole idea), it's
essential to stick to this rule.
I can understand your point of view, also FoxPro and VB should do it with some
changes. :)
My only reticence was the performance.
Ok, I think an implementation.
--
Xavi
El 28/12/2009 9:57, Viktor Szakáts escribió:
Hi,
testwmtx.prg may not work because Harbour internal can call Windows API and setting
"Last Error".
[I think in MT mode, with hbvmmt, does not work].
"
Some functions set the last error code to 0 on success and others do not.
You should call the GetLastError function immediately when a function's return.
"
Quite strange behavior :/
[ what if another thread kicks in between
function call and GetLastError() call...? ]
This means that wapi_GetLastError() can not be a wrapper 1:1 to Windows API
GetLastError().
Two solutions .-
One is to maintain a dynamic variable, thread safe, for each thread/process to
store last error and return this value in wapi_GetLastError().
And another solution is to return last error as the last parameter of each
wrapper function to Windows API that can set and remove wapi_GetLastError()
because returns values can not be true.
IMHO to Harbour this latter solution is probably the most easiest and effective
in terms of performance.
For example, with this solution testwmtx.prg would be like this .-
What do you think about this, comments?
I'd vote for first option, as it's the only one
that allows to keep full Windows API compatibility
for WAPI_* functions. Since this is the main point
for all WAPI_* functions (and the whole idea), it's
essential to stick to this rule. Otherwise we will
end up resorting to workarounds (altering calling
method) when return value is also some meaningful
value and we want to return that plus lasterror.
Brgds,
Viktor
_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour