Re: Assembly code with Borland's C compiler
- From: ArarghMail912NOSPAM@xxxxxxxxxxxxxxxxx
- Date: Sun, 27 Dec 2009 12:57:37 -0600
On Sun, 27 Dec 2009 17:23:59 +0000 (UTC), Hul Tytus <ht@xxxxxxxxx>
wrote:
comp.arch.embedded
Assembly code with Borland's C compiler
Anyone have suggestions regarding the form for assembley code files used
with Borland's version C compiler? The code below, assembled by masm6, doesn't
satisfy the linker (Borland's).
The segment names are a guess for the most part - taken from masm6's
accrued examples on other projects. "cs:DGROUP" appears off but, if the error
is due to segment names, maybe someone here knows suitable names?
The code & bat file & error messages are included below.
Hul
*********************************************************
; wedtst.asm
name SUPP32 ; ???
.386p
public _wedtst
; Segments & groups
DGROUP group _TEXT
_TEXT segment
assume cs:DGROUP,ds:DGROUP
_wedtst proc ; awk (WORD gdtsize, DWORD flataddr) void public
push bp ;save bp
mov bp,sp ; -> stack frame
mov eax, 66
pop bp ;restore bp
ret
_wedtst endp
_TEXT ends
end
Unless I have missed something, this will generate a 16-bit object,
and it looks like the c code (from below) is 32-bit. That generally
don't work.
Try something more like:
..386
..model flat
..code
_wedtst proc ; awk (WORD gdtsize, DWORD flataddr) void public
push bp ;save bp
mov bp,sp ; -> stack frame
mov eax, 66
pop bp ;restore bp
ret
_wedtst endp
end
--
******** bat file
SET BC55PATH=C:\BOR5
%BC55PATH%\bin\bcc32 -c -tW -a4 -g20 -I.. -I%BC55PATH%\include windil.c >
compout.txt
rem %BC55PATH%\bin\brc32 -i%BC55PATH%\include windil.rc >> compout.txt
%BC55PATH%\bin\ilink32 -L%BC55PATH%\lib -c -aa -Tpe c0w32+windil+wedtst,windil,
NULL,import32.lib+cw32.lib,, >> compout.txt
type compout.txt | more
******* compout.txt
C:\bor5\wed>SET BC55PATH=C:\BOR5
C:\bor5\wed>C:\BOR5\bin\bcc32 -c -tW -a4 -g20 -I.. -IC:\BOR5\include windil.c
1>compout.txt
C:\bor5\wed>C:\BOR5\bin\ilink32 -LC:\BOR5\lib -c -aa -Tpe c0w32+windil+wedtst,
windil,NULL,import32.lib+cw32.lib,, 1>>compout.txt
C:\bor5\wed>type compout.txt | more
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
WINDIL.C:
Warning W8057 WINDIL.C 48: Parameter 'hPrevinstance' is never used in function
WinMain
Warning W8057 WINDIL.C 48: Parameter 'szCmdLine' is never used in function
WinMain
Warning W8065 WINDIL.C 200: Call to function 'pooi' with no prototype in
function WndProc
Warning W8065 WINDIL.C 262: Call to function 'iitoaa' with no prototype in
function pooi
Warning W8070 WINDIL.C 265: Function should return a value in function pooi
Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland
Error: Unresolved external '_wedtst' referenced from C:\BOR5\WED\WINDIL.OBJ
ArarghMail912 at [drop the 'http://www.' from ->] http://www.arargh.com
BCET Basic Compiler Page: http://www.arargh.com/basic/index.html
To reply by email, remove the extra stuff from the reply address.
.
- Follow-Ups:
- References:
- Assembly code with Borland's C compiler
- From: Hul Tytus
- Assembly code with Borland's C compiler
- Prev by Date: Re: Assembly code with Borland's C compiler
- Next by Date: Re: Assembly code with Borland's C compiler
- Previous by thread: Re: Assembly code with Borland's C compiler
- Next by thread: Re: Assembly code with Borland's C compiler
- Index(es):
Relevant Pages
|