Skip to content

Proposal: Delay load option for OpenCV modules? #23235

@CSBVision

Description

@CSBVision

Descripe the feature and motivation

In #23187 it was discussed to optionally enable a delay load option of OpenCV's modules on Windows. This means that modules with heavy dependencies - for example the Python bindings with enabled CUDA support and contrib build - could delay load their dependencies. This yields a more flexible library distribution process by allowing the user to only distribute the actually needed instead of all modules, i.e. ignore unused DLLs.

As we recently worked on integrating the delay load option for CUDA libraries (cf. #22675 and #23209), it is relatively straightforward to integrate this: Define the /DELAYLOAD:opencv_<module><version>.dll flag for all enabled modules (exepct core as this is always required) and introduce a CMake variable OPENCV_ENABLE_DELAYLOAD that controls whether these flags are set or not.

Still, we wanted to propose / discuss this feature before implementing it. If you think this is a useful feature, the main question is in which CMake script it should be implemented.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions