For Programmers: Free Programming Magazines  


Home > Archive > ASM370 > March 2004 > Re: Assembler and C. How can I use extern in a mixture of C language and









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Assembler and C. How can I use extern in a mixture of C language and
Thomas David Rivers

2004-03-19, 8:28 pm


George,

You might want to look at Systems/C (http://www.dignus.com),
we have a lot of features that make mixing C and assembler easy!

But - if your compiling your C code with the IBM compiler,
and using RENT, then the external variable is in the PRV,
not just an assembler DS (e.g. a q-con.)

Systems/C has the __norent keyword to handle this, so you
would use:

extern __norent int TRYTHIS;

Feel free to contact us off-list; we'll be happy to help you!

- Dave Rivers -

George wrote:
>
> I get the following message when trying to link all C and ASM objects
> together:
>
> CCN2205(S) Unresolved reference to symbol "TRYTHIS".
> CCN2203(S) Unresolved references to objects are detected.
> CCN2340(U) Code generation was not performed due to previously
> detected errors.
>
> The reason this happens is because I have defined a variable in
> Assembler source file and try to refer to it in a C code in one of a C
> source files.
>
> in Assembler :
> TRYTHIS DS F'0'
>
> in C:
> extern long int TRYTHIS;
>
> void CALLFUNC_from_SOURCE_FILE2()
> {
> TRYTHIS=99;
> }
>
> Where is my mistake? How should it be done?.
> I have tried to use in Assembler:
>
> .......................
> .......................
> EXTRN TRYTHIS
>
> .......................
> ......................
> ADRRETCD DC A(TRYTHIS)
>
> .......................
> .......................
> L R15,TRYTHIS
> LA R15,0(R15)
>
> But have got a message from the linkage editor telling me that it is
> looking for TRYTHIS in a call library,etc,etc... So, I beleive it is
> looking for a entry point of a program, etc,etc. So, this did not work
> either.


--
rivers@dignus.com Work: (919) 676-0847
Get your mainframe programming tools at http://www.dignus.com
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com