FAQ
I think Plugin should be an interface for odd cases.

The oddest case I can currently think of is opengl on windows

opengl32, err := plugin.Open("opengl32.dll")

Won't work with a predefined system plugin struct because it would need to
be written as

func (p *plgnWinGL) LookupC(name string, valptr interface{}) (err error) {
     var funcptr uintptr
     // ask special gl specific dlsym func
     funcptr, err = wglGetProcAddress(name)
     // handle err

     if funcptr != 0 {
         // set valptr
         return // yay
     }

     // if we get here funcptr == 0 but the func may still exist in the
original dll
     // so we call the actual system dlsym
     funcptr, err = win32.GetProcAddress(p.dll, name)
     // handle err
     // set valptr if funcptr != 0
     return // yay?
}

All <= opengl 1.3 (maybe 1.4) symbols come from opengl32.dll but newer
stuff comes from wglGetProcAddress().
It is this way to override Microsoft doing their normal cripple the
competition thing.
See http://www.opengl.org/wiki/Load_OpenGL_Functions#Windows for more
(less?) info

--
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

People

Translate

site design / logo © 2021 Grokbase