INF: Mixed-Language Considerations for Pascal 4.0 and C

ID Number: Q66458

5.10 6.00 6.00a 6.00ax | 5.10 6.00 6.00a

MS-DOS | OS/2

Summary:

To link objects created with Microsoft Pascal version 4.0 and

Microsoft C version 5.1, 6.0, 6.0a, or 6.0ax into the same executable,

certain objects must be removed from the standard Pascal library.

SYMPTOMS

If these objects are not removed, the linker error "L2025: symbol

defined more than once" will occur on several symbols:

libpase.lib(nmalloc.asm) : error L2025: __nfree :

symbol defined more than once

libpase.lib(nmalloc.asm) : error L2025: __nmalloc :

symbol defined more than once

libpase.lib(amalloc.asm) : error L2025: __amblksiz :

symbol defined more than once

libpase.lib(os2\crt0.asm) : error L2025: __aexit_rtn :

symbol defined more than once

libpase.lib(os2\crt0.asm) : error L2025: __acmdln :

symbol defined more than once

libpase.lib(os2\crt0.asm) : error L2025: __asizds :

symbol defined more than once

libpase.lib(os2\crt0.asm) : error L2025: __astart :

symbol defined more than once

libpase.lib(os2\crt0.asm) : error L2025: __atopsp :

symbol defined more than once

libpase.lib(os2\crt0.asm) : error L2025: __acfinfo :

symbol defined more than once

libpase.lib(os2\crt0.asm) : error L2025: __aenvseg :

symbol defined more than once

libpase.lib(os2\crt0.asm) : error L2025: __cintDIV :

symbol defined more than once

libpase.lib(os2\crt0.asm) : error L2025: __amsg_exit :

symbol defined more than once

RESOLUTION

The following LIB command removes the proper objects from the

Pascal library. LIB will create a backup of the original library

called LIBPASE.BAK. Keep this backup copy for straight Pascal

linking.

lib libpase -crt0 -nmalloc -fmalloc -amalloc -pnmsize;

When linking, the /NOD and /NOE switches must be used on the link

command line, and the C libraries must be listed before the Pascal

library, for example:

link /NOD /NOE c.obj pascal.obj,test.exe,,mlibce libpase;

More Information:

This procedure described above is necessary because the newer

libraries that ship with C use different startup and memory handling

routines. Because the routines in the Pascal libraries don't work

correctly with the C libraries, the objects must be removed. Remember

when building your application to compile the C code with /AM, /AL, or

/AH option, because the Pascal code will require far function calls.

Additional reference words: 4.00 5.10 6.00 6.00a 6.00ax