extern "C" {
_declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
}
See here for some explanation of the mechanism->
https://github.com/urho3d/Urho3D/issues/139
http://stackoverflow.com/questions/16823372/forcing-machine-to-use-dedicated-graphics-card
I can view the exports of the final executable with "dumpbin /exports <executable name>"
[dumpbin is a tool installed with visual studio C++ tools]
How can I make my go executable export this value symbol?
I searched go link documentation but could not find something useful to achieve this.
I did some tests with cgo and "//export" command with a simple var, but that did not have any effect on "dumpbin /exports" output (no symbols exported)
I can see which GPU the executable is using by inspecting it with "process explorer" and its "dedicated GPU memory usage"
The go build "go-sdl2" app, by default, uses the CPU's embedded low performance integrated GPU, since I can not export this value with the executable.
Thanks for any help.
var vendorString string = gl.GoStringUb(gl.GetString(gl.VENDOR))
fmt.Printf("Vendor String is %v \n", vendorString)
//__declspec(dllexport) unsigned long NvOptimusEnablement = 0x00000001;
import "C"
go install -ldflags "-v -extldflags -Wl,--export-all-symbols" pkgdnm/opengl3perftest
--dynamic-list=dynamic_symbol_table.txt
{
extern "C"
{
"NvOptimusEnablement";
};
};
--export-all-symbols
/*
#cgo LDFLAGS: ${SRCDIR}/main.def
__declspec(dllexport) unsigned long NvOptimusEnablement = 0x00000001;
__declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
*/
import "C"
EXPORTS
NvOptimusEnablement @1 DATA
AmdPowerXpressRequestHighPerformance @2 DATA
go install -x -ldflags "-v -extldflags -Wl,--output-def,exports.def"