On Tue, Apr 14, 2009 at 12:35 PM, Amy <amynguye...@yahoo.com> wrote: > I am new at C programming in the Solaris environment. I have 2 source codes > written in C. The first is the main program. The second contains a function > that is called out by the main program. So in Solaris, when I compiled the > source codes, this is what I do: > > gcc main.c program2.c > > My executable file will be a.out > > The a.out file executes fine, but here's my question: > > I don't want to have the source code "program2.c" for people to see what's > inside that code. How can I still compile these 2 programs, where "main.c" > can be seen by everyone, but "program2.c" cannot.
This isn't really on-topic for this list, but I'll respond anyway. In the future, it may be helpful to grab a good book on C. Personally I would start with C: A Reference Manual (Harbison & Steele) and then moving on to K&R 2nd Edition. That said, I am not sure I understand your question. If you do not have the source code available on the system, then you cannot compile the software. If you are worried about someone having access to the source code, then do not distribute the source code (i.e. closed source). If this is a matter of not wanting to see the program2.c on the same command line as main.c, then you can compile each translation unit separately (for both Sun CC and GCC with the -c option. Remember that if you make use of -c, you must invoke the linker when you create your executable. For example: cc -o main.o -c main.c cc -o program2.o -c program2.o cc -o main main.o program2.o HTH, Steve _______________________________________________ opensolaris-code mailing list opensolaris-code@opensolaris.org http://mail.opensolaris.org/mailman/listinfo/opensolaris-code