Return to the technote repository LCC-Win32

Introduction

Here is some settings to respect in order to make a Magic DLL in LCC-Win32.

Structure alignment

Set the structure alignment to 1 (no alignment), by using the /Z1 option of the compiler. (The #pragma pack(1) directive also works).

For better performance, you can separate all the Magic stuff (MAGIC_BIND function, FUNC_DSC table) in a file, and only compile this file to 1 byte alignment, the other files can be compiled to default (8 bytes) alignement.

Export

Use this line in the .def file : EXPORTS MAGIC_BIND=MAGIC_BIND.

To verify that the export is correct, use the "Quick View" option in the contextual menu in explorer. Dependency Walker does this job far better.

Sample

An example of complete source (C source, makefile, .def,...) code is Cursor.