Chapter 4 Windows3.1 Compiler/Linker Issues
LabWindows/CVI Programmer Reference Manual 4-22
©
National Instruments Corporation
/Au option. You can either not use this option by setting it to None, or insert __loadds
in front of every function you export from the DLL.
Yo u can mak e the compiler e x port a f unction b y insertin g __export b etween the return
type and the function name, or by adding the function name to the exports section of the
.def file.
If you add the function name to the exp orts sect ion of the .def f ile, remember to con ve rt
the name to all caps if you use the PASCAL calling convention, or pre-append an
underscore if you use the CDECL calling convention.
Byte align structure members by choosing 1 Byte for the Options»Proj ect»Comp ile r»
Code Generation»Struct Member Byte Alignment.
Creating 16-bit DLLs with Borland C++
Consider the following issues or project options when you create a DLL with
BorlandC++ 4.x:
Every function you call from outsi de the DLL must be far, exported, and must load the
data segment into the DS register. The function must load the DS register if you want to
use any non-local variables in a function.
Use the large or huge memory model. The savings you gain by using smaller memory
models is not worth having to use the far keyword throughout your code. This project
option is in 16-bit Compiler»Memory Model»Mixed Model Override.
You can make the compiler load the data segment into the DS register by setting the
project option 16-bit Compiler»Memory Model»Assume SS Equals DS to Never, or
by inserting _loadds in front of every function you export from the DLL.
You can make the compiler export a function by inserting _export between the return
type and the function name, adding the function name to the exports section of the .def
file, or setting the option 16-bit Compiler»Entry/Exit Code»Windows DLL, all
functions exportable.
If you add the function name to the ex ports sectio n of the .def f ile, remember to conv ert
the name to all caps if you use the PASCAL calling convention, or pre-append an
underscore if you use the CDECL calling convention. Also, set the Generate Underscores
option in Compiler»Compiler Output.
Turn off the Allocate Enums as Ints option in Compiler»Code Generation.
Set the Data Alignment options to Byte in 16-bit Compiler»Processor.
Turn off the Case Sensitive Link and Case Sensitive Exports and Imports options in the
Linker»General.
Do not use the Linker Goodies options in Linker»16-bit Linker.

00ProRef.book : 06chap04.fm Page 22 Monday, March 9, 1998 3:23 PM