rick@bnrunix.UUCP (Rick Johns) (11/18/89)
Hi. I'm having trouble understanding something, or maybe it's just trouble believing something. When compiling a Pascal module that IMPORTs another module, it's necessary to use a $SEARCH$ compiler directive to tell the compiler exactly where to find the object code for the IMPORTed module. So, if module X IMPORTs module Y, the $SEARCH$ directive in X might be: $SEARCH 'Y.o'$ However, if I want to keep IMPORTed files in a central library someplace but still be able to compile Y locally (on occasion), I need something like: $SEARCH 'Y.o', '/stuff/Ylib.a'$ Now, though, the compiler still insists on finding Y.o, even though it might not be around. Y is still in Ylib.a, so what's the problem? I can think of a number of kludges to get around this, but they're all real ugly. Anyone have a graceful solution? While I'm on it, what is the advantage to this? Why can't I just specify on the command line what libraries and object files to link in? I saw something about guaranteeing that modules don't use each other (Y has to be compiled already when X is compiled, so Y can't use X) but it's hard to believe that this is the only way to do it. The source code should not contain pathnames of object files. It's ludicrous. Thanks in advance-- Rick Johns BNR Research Triangle Park, NC (919)991-7191 rti!bnrunix!rick@mcnc.org uunet!mcnc.org!bnrunix!rick@uunet.UU.NET rjohns@bnr.ca ================================================================================ The word is "its". "It's" is something else entirely. ================================================================================ Disclaimer: These opinions are mine and not BNR's.
steve-t@hpfcso.HP.COM (Steve Taylor) (11/19/89)
} / comp.sys.hp / rick@bnrunix.UUCP (Rick Johns) / 4:12 pm Nov 17,1989 / } While I'm on it, what is the advantage to this? Why can't I just specify } on the command line what libraries and object files to link in? .... } .... The source code should not contain pathnames of object files. } ---------- I haven't used Pascal on HP-UX yet, but I believe it is similar to Pascal on the Pascal Workstation, so I'll say a few words based on that. I'm sure someone will correct me if it doesn't apply to HP-UX Pascal. An unlinked object file from the Pascal compiler contains, in addition to the usual object code, a section of ASCII text which is the EXPORT section of the original module. The use of $SEARCH in conjunction with INPORT tells the compiler which object file to read this source text from. On one project I worked on, we keep the source text for the EXPORT sections of the modules in separate files, which we would $include where needed. These two approaches are equivalent, because in both cases the compiler is reading the source text to get the externally visible definition of the other modules. It's just that in one case it's reading the source from an obvious source file, and in the other ($SEARCH) it's reading the source text from an object file (where another compile previously copied it). I'm afraid I don't know the answer to your operational question, but I hope this will help explain why this is not equivalent to linking in C object files (say). It's more like #including header files. Regards, Steve Taylor NOT A STATEMENT, OFFICIAL OR OTHERWISE, OF THE HEWLETT-PACKARD COMPANY.