[comp.sys.ibm.pc] Microsoft C code called from MASM. Segment issues.

boozer@leedat.UUCP (G. Boozer) (02/17/90)

I am adding code to an assembly language code base of about one million lines.

I want to write some C code that will be used as subroutines to the assemble
code.  My question is how to tell C what the CS and DS segments are.

Thanks,


Glenn Boozer
Lee Data Corp, Networking Div.
{decwrl|pyramid|ames}!mips!leedat!boozer

mfinegan@uceng.UC.EDU (michael k finegan) (02/18/90)

boozer@leedat.UUCP (G. Boozer) writes:


>I am adding code to an assembly language code base of about one million lines.
>I want to write some C code that will be used as subroutines to the assemble
>code.  My question is how to tell C what the CS and DS segments are.

>Thanks,
>Glenn Boozer
>Lee Data Corp, Networking Div.
>{decwrl|pyramid|ames}!mips!leedat!boozer

While I have gone from C to Assembler, I haven't tried Assembler to C.

You need to look at pages 90-94 of the Microsoft Mixed Language Programming
Guide (comes MS Macro Assembler 5.1) - "Calling High-Level Languages from
Assembly".

They suggest starting in C, to guarantee any C initialization code is
executed, then calling your assembly code, which can then call C modules ...
It also looks like you will have to use the default MS 'language' (Pascal/
Basic/C) segments. I can't reproduce the table they show, here, but you
could always use the /Fa option to see what your C routine expects the
segments to be called ...

						Mike Finegan
						mfinegan@uceng.UC.EDU