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

Assembler syntax for declaring an external function's label name?

51 views
Skip to first unread message

Paul K. McKneely

unread,
Dec 19, 2011, 5:23:26 PM12/19/11
to
If I declare the printf function as an external function in the
following way...

extern printf

...I get the following error:

helo.asm(5): Error! E514: Colon is expected

Where would I put such a colon?

Thanks


Peter C. Chapin

unread,
Dec 19, 2011, 5:36:10 PM12/19/11
to
Do you need something like

extern printf:PROC

It's been a while since I've done anything with assembly language.

You might also need to use printf_ to match the names used by Open
Watcom's library.

Peter

Paul K. McKneely

unread,
Dec 19, 2011, 11:13:01 PM12/19/11
to
Yes. That's what I needed. So what word do you
use in place of PROC if it is a data structure?

Thanks.

"Peter C. Chapin" <PCh...@vtc.vsc.edu> wrote in message
news:jcoe8u$9b4$1...@www.openwatcom.org...

Peter C. Chapin

unread,
Dec 20, 2011, 9:09:41 AM12/20/11
to
On 2011-12-19 23:13, Paul K. McKneely wrote:

> Yes. That's what I needed. So what word do you
> use in place of PROC if it is a data structure?

It's basically a declaration and you need to provide a type.

extern something:WORD

Here type 'PROC' covers all "procedures." If you have a record defined I
suppose you use the name of the record type. I'm kind of guessing here.
As I said, it's been a long time. If you can find some MASM
documentation it's probably all covered in there.

Peter

Wilton Helm

unread,
Jan 6, 2012, 3:00:20 PM1/6/12
to
As Peter says, MASM documentation is your friend here.
The syntax of extrn is
extrn <label> : <type>
In this case, the <label> is a function call, so the type will be either
near or far. PROG (as Peter suggested) is a macro that provides the assumed
type based on the program model (Small, Large, etc) which make the resulting
code more portable.

Another issue that can arise is how the compiler "decorates" names. I would
generally enter it as
extrn "C", printf:near
or
extrn "C", printf:PROC
so that the requisite underscore will be assumed when the label is passed to
the linker.

Wilton


0 new messages