Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is MODULE library type in cmake?

cmake add_library documentation says,

SHARED libraries are linked dynamically and loaded at runtime. MODULE libraries are plugins that are not linked into other targets but may be loaded dynamically at runtime using dlopen-like functionality.

Practically, I can see both SHARED and MODULE type targets generate .so dynamic libraries on Linux. .so libraries are dynamically linked, loaded at runtime and be mapped using dlopen(). How do these two types of targets differ?

like image 243
Holmes.Sherlock Avatar asked Apr 18 '17 06:04

Holmes.Sherlock


1 Answers

The MODULE ones are intended to be loaded using dlopen only. You can't target_link_libraries() to the MODULE library.

As documentation states, MODULE keyword should be used to underline that a library is a plugin of some sort and shouldn't be linked using -l flag.

like image 144
arrowd Avatar answered Oct 20 '22 01:10

arrowd