TIP: Click on subject to list as thread! ANSI
echo: cis.os9.68000.osk
to: Pete Lyall 76703,4230 (X)
from: Bob van der Poel 76510,2203
date: 1992-11-22 18:25:08
subject: #17144-#12

#: 17147 S12/OS9/68000 (OSK)
    22-Nov-92  18:25:08
Sb: #17144-#12
Fm: Bob van der Poel 76510,2203
To: Pete Lyall 76703,4230 (X)

Thanks for the help, Pete. I got some help from the CDECL program (in the TOP
library). After I finally got it to compile I had it figure out things for me.
Here's the scoop:

1. I have an array "int indexes[KEYS1][KEYS2]" which holds a bunch of
   offsets into a database.

2. These are stored in a datamod which I load into memory when needed.

3. My program links to the datamod. So it needs two things. First a
   it needs a variable indexes which can be used to access the database.

                int (*indexes)[KEYS2];

   works fine. I can now do things like t=indexes[a][b]...

   The problem comes in transfering the address of the index in the datamod
   to the variable indexes. First off, we have to link to the
   module. So we make a declaration and create a variable to store the
   address of data mod:

   Smod *module, *modlink();

   After a successful link, I want to set 'indexes' to predetermined offset
   into the module. Here is the proper way:

   indexes=(int(*)[KEYS2])(module+xoffset);

   This casts the type of 'module' to that of 'index'.

On the other question...yes, I was afraid that I couldn't get those sizes at
compile time easily. Resorting to asm for this is probably not worth the
bother...I'll just use strlen() dynamically.

There is 1 Reply.

SOURCE: compuserve via textfiles.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.