Re: [oce-dev] Error using Static Libraries configuration

86 views
Skip to first unread message

D. Barbier

unread,
Aug 14, 2012, 9:12:02 AM8/14/12
to oce...@googlegroups.com
On 2012/8/12 Carlos wrote:
> Hi,
>
> I have installed OCE 0.10 with the static libraries flag and everything
> compiles OK except two error messages in TKV3dD.lib and TKOpenGLd.lib.
>
> The first one I think it is a bug in graphic3d_wntgraphicdevice.cxx as the
> definition of
>
> Graphic3d_WNTGraphicDevice::Graphic3d_WNTGraphicDevice (const
> Standard_CString theGraphicLib) is overpassed as the flags
> OCE_BUILD_STATIC_LIB and HAVE_NO_DLL are activated.
>
> As I use Graphic3d_WNTGraphicDevice() instead of
> Graphic3d_WNTGraphicDevice(theGraphicLib) I have removed the overload and it
> compiles OK.
>
> For the second one I do not understand the error but I suppose that it is
> related with the definition of InterfaceGraphic_RealizePalette, that is
> declared as dllexport and it is created in a static library, but I really do
> not know how to fix it.
>
> __declspec ( dllexport ) long InterfaceGraphic_RealizePalette ( HDC hdc,
> HPALETTE hPal, BOOL fBkg, BOOL fUseStatic )
>
> In a initial test this function is not called either so I have commented and
> all the libraries have compiled OK. Then the C# sample from Opencascade can
> be compiled an runs OK

Hello Carlos,

Thanks for reporting these issues.

> 1>TKV3dD.lib(Graphic3d_WNTGraphicDevice.obj) : error LNK2019: unresolved
> external symbol "private: void __thiscall
> Graphic3d_WNTGraphicDevice::SetGraphicDriver(char const * const)"
> (?SetGraphicDriver@Graphic3d_WNTGraphicDevice@@AAEXQBD@Z) referenced in
> function "public: __thiscall
> Graphic3d_WNTGraphicDevice::Graphic3d_WNTGraphicDevice(char const * const)"
> (??0Graphic3d_WNTGraphicDevice@@QAE@QBD@Z)

There are many ways to fix this issue, for instance by adding in the
#else clause:

void Graphic3d_WNTGraphicDevice::SetGraphicDriver (const
Standard_CString theGraphicLib)
{
Aspect_GraphicDeviceDefinitionError::Raise("SetGraphicDriver is
not available when using static libraries");
}

> 1>TKOpenGLd.lib(OpenGl_Window.obj) : error LNK2019: unresolved external
> symbol __imp__InterfaceGraphic_RealizePalette referenced in function
> "public: __thiscall OpenGl_Window::OpenGl_Window(class Handle_OpenGl_Display
> const &,struct CALL_DEF_WINDOW const &,void *)"
> (??0OpenGl_Window@@QAE@ABVHandle_OpenGl_Display@@ABUCALL_DEF_WINDOW@@PAX@Z)
>
> 1>Debug\OCC.dll : fatal error LNK1120: 2 unresolved externals

I am not familiar with Windows and cannot test, but you may try to
edit inc/InterfaceGraphic_WNT.hxx and replace

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

__declspec( dllimport ) long InterfaceGraphic_RealizePalette ( HDC,
HPALETTE, BOOL, BOOL );

#ifdef __cplusplus
}
#endif /* __cplusplus */

by

#include <Standard_Macro.hxx>
Standard_IMPORTC long InterfaceGraphic_RealizePalette ( HDC,
HPALETTE, BOOL, BOOL );

Denis

QbProg

unread,
Aug 20, 2012, 2:28:14 PM8/20/12
to oce...@googlegroups.com
I can take a look on this as soon as I get back home :) could you open a bug for this on the meantime?

2012/8/14 D. Barbier <bou...@gmail.com>

D. Barbier

unread,
Aug 20, 2012, 6:49:41 PM8/20/12
to oce...@googlegroups.com
On 2012/8/20 QbProg wrote:
> I can take a look on this as soon as I get back home :) could you open a bug
> for this on the meantime?

Thanks Qb, issue #295 is assigned to you ;)

Denis

QbProg

unread,
Aug 25, 2012, 10:34:08 AM8/25/12
to oce...@googlegroups.com
(cross-posted to the bug)

I've added a branch qb/static-fixes with the changes proposed by denis.
Instead of raising an exception I've just called the SetGraphicDriver (), so the user doesn't have to change the code between configurations, it just works.
I had to add #include <Standard_Macro.hxx> in the InterfaceGraphic_WNT.hxx too.

Carlos, could you just test this branch? Visualization in a static configuration has not been tested though, we could use this opportunity to check it. There may be issues with OCAF plugins too.
Qb
Reply all
Reply to author
Forward
0 new messages