Path: ...!eternal-september.org!feeder3.eternal-september.org!i2pn.org!i2pn2.org!.POSTED!not-for-mail From: John Reagan Newsgroups: comp.os.vms Subject: Re: Fun trick Date: Mon, 13 Jan 2025 21:11:29 -0500 Organization: i2pn2 (i2pn.org) Message-ID: References: <67855f5f$0$714$14726298@news.sunsite.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Tue, 14 Jan 2025 02:11:29 -0000 (UTC) Injection-Info: i2pn2.org; logging-data="3496715"; mail-complaints-to="usenet@i2pn2.org"; posting-account="85Cwws6+ypgQVu4foqgE6eSuYb0IIJZq6Fz6j0v4a/s"; User-Agent: Mozilla Thunderbird X-Spam-Checker-Version: SpamAssassin 4.0.0 In-Reply-To: Content-Language: en-US Bytes: 2123 Lines: 33 On 1/13/2025 5:55 PM, Arne Vajhøj wrote: > On 1/13/2025 5:18 PM, Lawrence D'Oliveiro wrote: >> On Mon, 13 Jan 2025 13:45:50 -0500, Arne Vajhøj wrote: >>> There are probably a lot of shareable images written in C out there >>> where the developer has no idea that they are runnable or what code will >>> run. >> >> If it has no main(), then nothing will run. > > That is what the developer thinks. > > But it is not so. > > $ type lawrence.c > #include > > int foobar() > { >     printf("Hi Lawrence\n"); >     return 1; > } > $ cc lawrence > $ link/share  lawrence > $ run lawrence > Hi Lawrence > > No main() and it runs anyway. > > Arne > COBOL paragraphs behave like C. First routine/PARAGRAPH gets a WEAK transfer address. Linker finds the first one. Shuffle modules around and you'll get different transfer addresses. Pascal just creates a STRONG transfer address for a PROGRAM statement.