Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!samsung!spool.mu.edu!uwm.edu!bionet!agate!ucbvax!ENG.SUN.COM!wmb From: wmb@ENG.SUN.COM (Mitch Bradley) Newsgroups: comp.lang.forth Subject: Forth access to external procedures Message-ID: <9104151507.AA12333@ucbvax.Berkeley.EDU> Date: 15 Apr 91 06:43:25 GMT Sender: daemon@ucbvax.BERKELEY.EDU Reply-To: Mitch Bradley Organization: The Internet Lines: 38 > > I have a fair amount of experience in this area; I have developed >"call > > compilers" to allow Forth to call external routines for about a >dozen > Mitch, > > I've been experimenting with external calls on DOS machines. Intuitively it > seems like this ought to be easy. But the format of the DOS object code > completely escapes me. I beleive that this is one of the reason that windows > created the new DLL format. Although I can't find out what that is. > > Have you had any success using DOS? > > Gene One of the most difficult problems with linking Forth to externally-generated procedures is the fact that most popular low-end machines (PC, Mac, Atari) have no single "standard" software development environment. With Unix systems like Sun workstations, you can count on there being a "preferred" software development environment, with a well-known single linker/object file format. The PC world has several competing development environments, and their object file formats are not necessarily compatible. I haven't solved the dynamic linking problem in the PC environment (in fact, I haven't really tried; the PC Forth marketplace is crowded, and I don't choose to devote my development resources to that market). I have solved the static linking problem with my C Forth 83 product, which happens to run on PCs. The key is to let the C compiler take care of it. C Forth 83 lets you add entries to the C switch statement at the core of the Forth kernel, and those new entries can call externally-supplied subroutines. You just let the C linker worry about the object file formats. The advertisements for HS Forth claim that it allows pretty general cross-language linkage, and I expect that LMI has something along those lines too, at least with their "compiled to object code" Forth product that is based on Tom Almy's work. Mitch