Documentation on the dl family of calls

Introduction

The implementation of dlopen, dlclose, dlsym, and dlerror allow '.dll's to have almost the same behavior as '.so' on UNIX:

Description:

This functionality depends on the hypothesis that in a forked process the dlls will be mapped at the same addresses as in the parent if they are loaded in same order.

How to use it:

In your dll code you must

1) #include <cygwin/cygwin_dll.h>

then use the declaration macro:

DECLARE_CYGWIN_DLL(<your entry point>);

Note that the fixup to terminate import section is included in macro.

2) In the link phase use "__cygwin_dll_entry@12" as entry point. Note that you may have to perform 3 link passes.

3) dlfork is a new Cygwin-specific function. Its prototype is in dlfcn.h. dlfork takes an int as an argument which can have the following values:

The dlfork flag is a global variable which is not inherited by child process. (I.e. a forked process begins always with FORK_NO_RELOAD).