Subj : Re: Inline Assembler bug with structs of certain size To : borland.public.cpp.borlandcpp From : Ed Mulroy [TeamB] Date : Thu Dec 02 2004 02:34 pm When I built to compile via assembly it seemed to handle the code generation well. When I built without that, I saw the same thing you reported, the second function's assembly mov instruction was not generated. You expressed a desire for the functions and structures to be near and I did not want the structures to be declared static because of possible difficulties in seeing their locations in the debugger, I made a version which made them near, changing the following lines to how they appear below: ------------------- } __near TestStruct1; } __near TestStruct2; unsigned __near asm_test1(void) { unsigned __near asm_test2(void) { ------------------- The program name I used was ques408.c for yours and ques408B.c for the one I altered to use __near. Ques408C.c is a copy of yours with the name changed to build an exe via assembly instead of all in the complier. You can arrange to build via assembly in two ways, by giving the command line compiler the -B option or by putting this pragma at the top of your program when using either of the IDE or the command line. #pragma inline The make file I used to build these is shown below. As you can see, it is not complex. ---------------------------- Done : ques408.exe ques408B.exe ques408C.exe @echo Done ques408C.exe : ques408C.c bcc +config.cfg -B ques408C.c ques408C.c : ques408.c @copy /v ques408.c ques408c.c ques408B.exe : config.cfg ques408B.c bcc +config.cfg -B ques408B.c ques408.exe : config.cfg ques408.c bcc +config.cfg ques408.c config.cfg : copy &&| -v -1 -ml -RT- -x- -TLA -Id:\c\bc5\include | config.cfg ---------------------------- Below is a screen capture of the build and run of the programs. ---------------------------- F:\Projects\lookat\q408>make MAKE Version 5.2 Copyright (c) 1987, 1999 Inprise Corp. copy MAKE0000.@@@ config.cfg 1 file(s) copied bcc +config.cfg ques408.c Borland C++ 5.2 Copyright (c) 1987, 1997 Borland International Mar 19 1997 17:29:40 ques408.c: Turbo Link Version 7.1.32.2. Copyright (c) 1987, 1996 Borland International bcc +config.cfg -B ques408B.c Borland C++ 5.2 Copyright (c) 1987, 1997 Borland International Mar 19 1997 17:29:40 ques408b.c: Turbo Assembler Version 4.1 Copyright (c) 1988, 1996 Borland International Assembling file: ques408b.ASM Error messages: None Warning messages: None Passes: 1 Remaining memory: 393k Turbo Link Version 7.1.32.2. Copyright (c) 1987, 1996 Borland International bcc +config.cfg -B ques408C.c Borland C++ 5.2 Copyright (c) 1987, 1997 Borland International Mar 19 1997 17:29:40 ques408c.c: Turbo Assembler Version 4.1 Copyright (c) 1988, 1996 Borland International Assembling file: ques408c.ASM Error messages: None Warning messages: None Passes: 1 Remaining memory: 393k Turbo Link Version 7.1.32.2. Copyright (c) 1987, 1996 Borland International Done F:\Projects\lookat\q408>ques408 length of asm_test1 = 8 &TestStruct1 = 0b70, via asm = 1441 length of asm_test2 = 5 &TestStruct2 = 594a, via asm = 1441 F:\Projects\lookat\q408>ques408b length of asm_test1 = 8 &TestStruct1 = 0b70, via asm = 1441 length of asm_test2 = 8 &TestStruct2 = 594a, via asm = 1441 F:\Projects\lookat\q408>ques408c length of asm_test1 = 8 &TestStruct1 = 0b70, via asm = 1441 length of asm_test2 = 8 &TestStruct2 = 594a, via asm = 1441 F:\Projects\lookat\q408> ---------------------------- .. Ed > Jeremy wrote in message > news:41ae833d$1@newsgroups.borland.com... .