I'm pretty sure wglGetProcAddress is all you need. It uses opengl32.dll. At least, GLEW uses only the wgl function and seems to get everything right.
Anyhow, this kind of thing seems outside the scope of a plugin package, because OpenGL isn't a plugin. Programs that use it depend on it being there.
It seems you can call golang code from c++? How does it work for non-go programs which can only load functions via c/c++ dynamic link libs?
On Sep 5, 2014 11:09 AM, <gerald...@gmail.com> wrote:
>
> the go runtime...
>
> matlab's loadlibrary (requires the path to the dll and the header file) does a dlopen in Unix or LoadLibrary in Windows.
> it just loads a dynamically-linked library
it's possible to arrange the runtime to be initialized automatically when dlopened,
but we need to be careful when people load multiple go plugins to the same process.
btw, that's how you can have static initializers in C++ shared libraries.
On Thu, Sep 18, 2014 at 11:05 PM, mortdeus <mort...@gmail.com> wrote:
> It would be cool if we could add an execution mode for building kernel modules.
That would be a lot of work. The Go runtime requires threading and
memory allocation support, and all of that would have to be written.
And I really can't see many people writing a kernel module in a
garbage collected language.
I work on a garbage collected language. I understand the arguments.
I still think that I am correct: I really can't see many people
writing a kernel module in a garbage collected language.
You'll want to learn to write kernel modules in the same language and with the same APIs as everybody else. Once you've mastered that, then you can explore the technical and political challenges of using a different language in the kernel.
--
However those challenges only make the proposal more attractive in my opinion. If upstream rejects a kernel module pull request solely based on the fact that it is written in Go; despite the module being well written and reasonably efficient, then I say their prejudice is in hostile conflict with the pace of innovation.
The good news is that outstanding technology can change the way people precieve what makes a technical idea good or bad. Go has already had such an impact on many developers who were convinced using a type-safe, garbage collected language for low level system development is a pipe dream held by loonies and heretics.
I think that the notion of a meaningful ABI for a shared library is
only supportable for C. It takes heroic effort to make it work for
C++. I don't see any plausible way to make it work for Go.
For example, mypkg1.1 decides that
Point needs to change to V@0 uint64, X@8 uint64, Y@16 uint64.
mypkg1 has a function F that takes a Point argument, and so does mypkg1.1.
You have existing code that calls F and new code that calls F.
Now we need to talk about the methods
defined on a type: in mypkg1 Point has some methods, and in mypkg1.1
we drop some existing methods and add some new ones.
And even that is a simple case. We need to talk about reflection.
There is Go code that thinks it knows what a PkgPath means, because
its documented to work a certain way. When your program imports two
different instances of the same package, what is the PkgPath value
when you use reflection on the different types?