Red Hat ENTERPRISE LINUX 3 - USING ID Using Instructions page 30

Using ld, the gnu linker
Hide thumbs Also See for ENTERPRISE LINUX 3 - USING ID:
Table of Contents

Advertisement

26
Solution 2:
--foo.h
/* Note: auto-export is assumed (no __declspec(dllexport)) */
#if (defined(_WIN32) || defined(__CYGWIN__)) && \
!(defined(FOO_BUILD_DLL) || defined(FOO_STATIC))
#define FOO_IMPORT __declspec(dllimport)
#else
#define FOO_IMPORT
#endif
extern FOO_IMPORT int arr[];
--foo.c
#include "foo.h"
void main(int argc, char **argv){
printf("%d\n",arr[1]);
}
A fourth way to avoid this problem is to re-code your library to use a functional interface rather
than a data interface for the offending variables (e.g. set_foo() and get_foo() accessor functions).
[This option is specific to the i386 PE targeted port of the linker]
-disable-auto-import
Do not attempt to do sophisticalted linking of
from DLLs. [This option is specific to the i386 PE targeted port of the linker]
-enable-runtime-pseudo-reloc
If your code contains expressions described in -enable-auto-import section, that is, DATA imports
from DLL with non-zero offset, this switch will create a vector of 'runtime pseudo relocations'
which can be used by runtime environment to adjust references to such data in your client code.
[This option is specific to the i386 PE targeted port of the linker]
-disable-runtime-pseudo-reloc
Do not create pseudo relocations for non-zero offset DATA imports from DLLs. This is the
default. [This option is specific to the i386 PE targeted port of the linker]
-enable-extra-pe-debug
Show additional debug info related to auto-import symbol thunking. [This option is specific to
the i386 PE targeted port of the linker]
-section-alignment
Sets the section alignment. Sections in memory will always begin at addresses which are a mul-
tiple of this number. Defaults to 0x1000. [This option is specific to the i386 PE targeted port of
the linker]
-stack
reserve
-stack
,
reserve
commit
Specify the amount of memory to reserve (and optionally commit) to be used as stack for this
program. The default is 2Mb reserved, 4K committed. [This option is specific to the i386 PE
targeted port of the linker]
to
_symbol
__imp__symbol
Chapter 3. Invocation
for DATA imports

Advertisement

Table of Contents
loading

This manual is also suitable for:

Enterprise linux 3

Table of Contents