Successfully built as static lib (solved TKOpenGL dinamic load)

Hi all,

As I didn't found a solution, I made a small patch that allows to statically link OpenCascade, including the TKOpenGL stuff.
It's enough to modify Graphic3d_GraphicDevice.cxx file as :

extern "C"
{
Handle(Graphic3d_GraphicDriver) MetaGraphicDriverFactory(const Standard_CString AShrName);
}

void Graphic3d_GraphicDevice::SetGraphicDriver ()
{

Handle(Graphic3d_GraphicDriver)(*fp) (Standard_CString) = NULL;
fp = (Handle(Graphic3d_GraphicDriver)(*) (Standard_CString)) MetaGraphicDriverFactory;
Standard_CString aSharedName = "something";
MyGraphicDriver = (*fp)(aSharedName);
}

of course, it would be possible to check if statically built or not and choose between old and
new code.

Ciao

Max

Massimo Del Fedele's picture

Or, even *much* simpler......

extern "C"
{
Handle(Graphic3d_GraphicDriver) MetaGraphicDriverFactory(const Standard_CString AShrName);
}

void Graphic3d_GraphicDevice::SetGraphicDriver ()
{
MyGraphicDriver = MetaGraphicDriverFactory("");
}

Just an one-line patch :-)

Ciao

Max

QiweiLiu's picture

It's very nice.I'll try.