OpenSubdiv
OpenSubdiv copied to clipboard
Support dynamic linking on Windows
This is a continuation of #27 for Windows.
My code so far is available on my windows branch here.
The idea is to have a define (i.e. OSD_API) to switch bewteen
__declspec(dllexport)
and
__declspec(dllimport)
Also, if we want the headers to work with dynamic link by default, it's better to flip all the conditions from OSD_DLL to something like OSD_STATIC. This way, the header file will be ready to use for dynamic linking by default. And if the client wants to do static link, the client will have to define OSD_STATIC instead.
After defining OSD_API, we just need to mark classes/methods that we want to expose through the DLL. I've done so with all the dispatchers. So currently, the glutViewer should link and run with dynamic OSD.
I haven't gotten to the ptex classes yet. So the ptexViewer doesn't link right now. I'll try to get to that next.
I've updated the windows branch to include the patch for export ptex classes as well. The ptexViewer will now link dynamically with OSD.
I have revived my commits for supporting dynamic linking on Windows. They're more or less the same as before, except updated to the latest OSD code. The commits are still WIP, and some things need to be sorted out. But for now, I've pushed the new commits to my windows_dll branch for those interested.
Filed as internal issue #151683.