Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Assembly code with Borland's C compiler

106 views
Skip to first unread message

Hul Tytus

unread,
Dec 27, 2009, 12:28:28 PM12/27/09
to
comp.os.ms-windows.programmer.win32
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

******** 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

Hul Tytus

unread,
Dec 27, 2009, 5:41:09 PM12/27/09
to

Friedel Jantzen

unread,
Dec 28, 2009, 2:49:10 AM12/28/09
to
Hi,
I do not know if this is a hint for you.
I used tasm and BC 5.02 as follows:
d:\bp\bin\tasm.exe /ML d:\xed32\xed32asm.asm d:\xed32\xed32asm.obj
IIRC I got the section names using tdump with a BC 5.02 app.

;asm
NOSMART
.386
LARGESTACK
.text SEGMENT PUBLIC USE32

ASSUME cs:.text, ds:NOTHING, es:NOTHING

PUBLIC _TestFunction
; Prototype: extern "C" int TestFunction(int x1, int x2);


_TestFunction proc
...
ret
_TestFunction endp

.text ENDS

END

Regards,
Friedel

d...@kbrx.com

unread,
Dec 28, 2009, 4:03:08 PM12/28/09
to
Friedel - the format of the code you sent may make a difference - one way
to see. Along these same lines, do you have a copy of the syntax used with
the linker? The cause may lay there rather than within the code itself.

Hul

ps - thanks once again for the examples of required syntax for borland's
compiler & ms' win32.

Hul Tytus

unread,
Dec 28, 2009, 4:53:05 PM12/28/09
to
comp.os.ms-windows.programmer.win32
Assembly code with Borland's C compiler

More working with Borland's compiler: trying to link 2 .obj files generated
by Borland's compiler without any errors indicated, untill the .exe is
executed. Then windows pops a window saying, roughly, this application has
generated an error and we are closing the application - an error log is being
created.
Anyone know where Microsoft hides their error logs?

Hul


Friedel Jantzen

unread,
Dec 29, 2009, 2:04:29 AM12/29/09
to

> Anyone know where Microsoft hides their error logs?
You can view the event log in the control panel, enter:
eventvwr.msc

hth, Friedel

Friedel Jantzen

unread,
Dec 29, 2009, 3:02:02 AM12/29/09
to
Hi, Hul!

Am Mon, 28 Dec 2009 21:03:08 +0000 (UTC) schrieb d...@kbrx.com:

> Friedel - the format of the code you sent may make a difference - one way
> to see. Along these same lines, do you have a copy of the syntax used with
> the linker? The cause may lay there rather than within the code itself.

As I used the resulting obj file with BC 5.02 IDE, I haven't.
It is some time ago, that I worked with BC55; IMO your linker call is ok.

I assume, you assembled the obj file with tasm?
If you use masm, you get a COFF type obj, but BCC needs OMF. Use coff2omf
then to convert it, if you do not have tasm.



> ps - thanks once again for the examples of required syntax for borland's
> compiler & ms' win32.

In the meantime I got to know these links:

http://www.winprog.org/tutorial/bcpp.html

http://members.aon.at/fraba/ccomp.htm
(Afaik in German only, but with excellent samples)

Regards,
Friedel

d...@kbrx.com

unread,
Dec 29, 2009, 5:58:20 PM12/29/09
to
Bingo (hopefully). The MS assembler was used. Hul
0 new messages