Re: 4gl and C
Posted in 1994
->Date: Fri, 2 Sep 1994 10:03:29 -0600 (MDT) ->From: Con Woodall <cwoodall@vth1.vth.colostate.edu> ->Subject: 4gl and C ->To: informix-list@rmy.emory.edu -> ->A quick cry for expertise if you have been around this problem. I am ->trying to use some C functions called from 4gl. I have done this on a ->other occasions and though I am not a C programmer, what I am doing ->seems to me to be reasonably analogous to what I have done before which ->has been successful. -> ->Generally my 4gl does -> ->define p_filename char(12) -> ->call set_params(p_fieldname) -> -> ->The c function in question includes -> ->char *p_fieldname[12]; -> ->popquote (&*p_fieldname, 12); Change the above to: char p_fieldname[13]; /* need array of char, not array of char* */ popquote (p_fieldname, 13); /* also need room for null string terminator */ /* name of array acts as pointer here */ -> ->workname = *p_fieldname; -> ->c globals includes -> ->char *filename -> -> ->The failure of the call causes a segmentation fault and a core dump. I ->am also trying to decipher the dump, but I thought someone might have ->encountered the problem and see some way around it. By the way the c ->compiler does give me a warning on the "workname = *p_fieldname" saying ->that the operands are pointers to different types, but I think I might be ->stuck with this combination. I have tried a number of other combinations ->which the compiler won't let me past. -> ->Any light shed on the subject would be of benefit. -> ->-- ->Con Woodall Colorado St. U.; Veterinary Teach. Hosp.; Ft. Collins CO 80523; ->303-491-1244 FAX 303-491-4414 cwoodall@vth1.vth.colostate.edu ->You can do anything with a computer, but you might not want to. This should fix it. If not, give me a call, Con. Alan ___________________________ ______________________| R. Alan Popiel |__________________________ \\ Internet: | Martin Marietta, SLS | / \\ alan@den.mmc.com | P.O. Box 179, M/S 3810 | Std disclaimers apply. / )Voice: | Denver, CO 80201-0179 USA | ( / 303-977-9998 |___________________________| (But you knew that!) \\ /________________________) (____________________________\\