1
General / Re: How to: create DLL file for Windows 10 64-Bit Pro
« Last post by 440bx on Today at 10:05:27 pm »If it works correctly when called accordingly (namely by not passing a pointer or by dereferencing it) it does not make it incorrect. It is simply not equivalent to how it's declared in MSDN.I'm afraid I have to disagree. It is incorrect. One of the reasons (yes, there is more than one) it is incorrect is because there is no documentation of FPC's "flavor" (that's the diplomatic word, the accurate word is _wrong_) of WriteFile. This means that when a Pascal programmer looks up how to call WriteFile, that user is going to find (apparently, "surprisingly" to some Pascal programmers) the MSDN definition and its documentation. After the unsuspecting soul codes the call to WriteFile as specified by MS, a "miracle" happens: it doesn't work BUT, some Pascal programmers here (you among them) say the FPC WriteFile definition isn't wrong, the guy just didn't read the right (likely non-existent) FPC WriteFile documentation.
There is one thing I must agree with you: the definition is not "equivalent", definitely not. We are in complete agreement.
If one knows how, one can still treat it as optional:Of course, why do it right when it can be done wrong and work around the wrong definition by using a rather questionable trick. The whole purpose of "var" is to specify that a _reference_ is required.
WriteFile(h, buf, SizeOf(buf), DWord(Nil^), Nil);