tags:

views:

51

answers:

2

Hi,

In the Makefile.in of an existing c++ project on linux (ubuntu), it has this:

EXPORTS     = \
        gtkmozembed.h \
        gtkmozembed_glue.cpp \
        gtkmozembed_internal.h

Can you please tell me what does EXPORTS mean?

Thank you.

+1  A: 

EXPORTS is just the name of a list of files. It might mean these files are being installed to a location where others can use them. Header files with implementation details not of interest to the user of a library can be kept private.

A .cpp file in EXPORTS can mean it contains skeleton code users have to compile and link into their projects.

Your example is from Firefox. It's defined as:

export:: $(EXPORTS) 
    $(INSTALL) -m 444 $^ $(PUBLIC_EXPORT_DIR)

Copying or installing files in Makefiles is a bit problematic. Note that there is no dependency between the copy and its original.

Eddy Pronk
A: 

Imagine that:
You are a designer of library (DLL). You have to define what library must to do ... and after that you write it. Many process can use your functions from this DLL, there are one piece of memory in your RAM.
When you include this library to your project (for example in c++) you have to add some informations about functions in this DLL.

First option:
You can declare some interfaces of library functions (then your linker is happy ;) ). For example: __declspec(dllexport) int my_function(char *);
After that names of exported objects are completed in your programme (linker job ;) )... but Names of this objects depends on language, compiler, blah blah blah

Second option:
You add to the project of your library some informations to the linker (file *.def). That file has two sections: LIBRARY and SECTIONS. LIBRARY is internal name your lib:
LIBRARY my_lib
In EXPORTS section are symbols which can by exported from library.
EXPORTS
function1
function2
function3

You can see, this functions doesn't have types, formal parameters etc. When you include this lib, you don't have any information about function.

When you do this (.def file) and compile your lib, you have got .dll and .lib file. Second file can be use to link library in execution time.
If you want check exports in this library you can use "Dependecny Walker" or "dumpbin":
dumpbin my.dll /exports

Next you can load that library:
first option: __declspec(dllimport) int my_function(char *);
or
second: HMODULE LoadLibrary(LPCSTR lpszLibName);

conlusion: using exports can create more universal lib (but more complicated)

(sorry for my very bad english :/)

vizzdoom
Thank you. But if 'In EXPORTS section are symbols which can by exported from library.', why in my example, it has .h files?
michael