Compile without DLLs?

How to compile Open CASCADE without DLLs?

For example, I tried to compile DRAW.EXE without DLLs by adding this preprocessor definition:

But, I get hundreds of compilation errors.

1>------ Build started: Project: DRAWEXE, Configuration: Release Win32 ------
1>..\..\..\inc\Draw_Viewer.hxx(51) : error C2146: syntax error : missing ';' before identifier 'Draw_Viewer'
1>..\..\..\inc\Draw_Viewer.hxx(51) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>..\..\..\inc\Draw_Viewer.hxx(52) : error C2146: syntax error : missing ';' before identifier 'Standard_Boolean'
1>..\..\..\inc\Draw_Viewer.hxx(52) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>..\..\..\inc\Draw_Viewer.hxx(54) : error C2144: syntax error : 'void' should be preceded by ';'


This is for Windows platform, VC9, 32-bit.
Open CASCADE 6.7.0.

shmsh's picture

Dear Glenn,,,,

why without DLLs !!!!

any good reason?
DLLs are the Dynamic Link Libraries, (DLL) is a collection of small programs, which can be called upon when needed by the executable program (EXE) that is running

The advantage of DLL files is that, because they do not get loaded into random access memory (RAM) together with the main program, space is saved in RAM. When and if a DLL file is called, then it is loaded. For example, you are editing a Microsoft Word document, the printer DLL file does not need to be loaded into RAM. If you decide to print the document, then the printer DLL file is loaded and a call is made to print.
I think what happened actually is that the DLLs were called during building process but they were not found

how it gonna work then ???

mako916's picture

Thank you, I understand how DLLs work. Memory is not an issue.

Can someone please answer my question?

How to compile Open CASCADE as a single static library, without DLLs?

Forum supervisor's picture

Dear Glenn,
I just would like to warn you that we don't support building of Open CASCADE as a single static library and we don't plan such support at least for the nearest future.
Nevertheless if the problem is critical for you (or you will meet technical difficulties) I would suggested you to use our professional support services In this case you may contact us via the Contact Form We will try to find a solution/workaround acceptable for you.

Best regards

mfregeau's picture

The question was not "as a single static library" but rather using cascade in static libraries rather than DLL. As far as I know, it is not a single DLL either. It's a personal choice, and I believe there should not be any difference for the developers of Opencascade other than giving guidance on how to compile in static, if any flags need to be turned on or what not. I am also curious on if there are any specific way that Opencascade need to be compiled to use as static libraries? Thank you

Kirill Gavrilov's picture

There is build library type option (Shared/Static) in CMake scripts. I have never tried it on Windows, but it works at least for Android builds - have you tried it?

It should be noted, though, that (currently) it is not possible using static libraries for Draw Harness modules,
since its plugin system requires libraries being loaded dynamically (and each plugin having PLUGINFACTORY function exported).