We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I am writing a library for 8051 mcu. this library call some outside functions, i mean some routine defined by user, I am not sure how far those codes will be seperated from my library in code space, to be sure, I like to force compiler generate a long jmp for all these calls. ( I am writting some stub to simulate user's routines now.)
The tools take care of this - you do not need to worry!
There is no way to force any 'C' compiler to generate any specific machine instruction(s). That's the whole point: http://www.8052.com/forum/read.phtml?id=68927
The linker optimizes calls from LCALLs to ACALLs, not the compiler. Only the linker knows how far away the target code actually is. It sounds like you're talking about a statically linked library. In that case, don't worry about it and let the linker handle it. If you don't compile with the OBJECTADVANCED (OA) directive, the compiler won't put information in the .objs that lets the linker perform this optimization in the first place. So you'd be stuck with LCALLs even if the routine was close.
#pragma ROM (LARGE) or Options for target -> target->Code rom size select Large:64k program