Quote Originally Posted by wqweto View Post
Yes, this might work if the check in the client code is NvOptimusEnablement != 0 because the first couple of instruction in the VB6 function prolog are definately *not* all zeroes.
Yep, that's what I was counting on - and it worked as expected ...
(I did test this with an RC5-CairoSurface in "D2D"-UploadMode on Win10)

And sure, defining a Zero behind the exported Symbol is not possible this way (using a procedure-def).
But that (exporting a Zero) is probably not what this export is meant to accomplish (for those who use it in C/C++).

Also experimented a bit, to export (from a *.bas-module):
- a normal Public Const NvOptimusEnablement As Long = 1
- as well as a normal Variable as: Public NvOptimusEnablement As Long
(along with the same *.vbp Linker-section)
... but this didn't work (an "unrecognized symbol" was thrown at me)
I've then tried to make it easier for the Linker, by explicitely specifying a *.def file, but "no cigar" either...

But the little Sub worked "well enough" (even without the *.def).

Olaf