Re: core dump with pro*c compile

From: Jeffery Cann <jcann_at_fairway.com>
Date: 1998/02/13
Message-ID: <34E4E2E9.73002F2F_at_fairway.com>#1/1


The problem is the flags you send to the pro*c compiler.

Specifically, the dbms=v6_char .

You would only define the dbms as v6_char when you need backward compatibility to run your program against Oracle 6 databases.

I recommend changing this to dbms=v7_char.

Hope this solves the problem.
Jeff

Leon T wrote:
>
> I'm running oracle 7.3.3 on a sun solaris platform. I get a core dump
>
> when attempting to execute a simple program to connect to and
> disconnect
> from the oracle database. When looking at the generated c-code, it
> appears that I crash during the connect statement.
> ( sqlcxt((void **)0, &sqlctx, &sqlstm, &sqlfpn); )
>
>
> I also tried using the proc.mk makefile to compile my program
> but I still core dump. I'm also core dump when trying to
> compile and run the sample programs. The following source code,
> makefile, and output follows.
>
> Thanks,
> Leon T.
> lstjr_at_concentric.net
>
>
>
>
> /* lttest.pc */
> #include <stdio.h>
> #include <stdlib.h>
> #include <string.h>
> #include <sqlca.h>
>
> void sqlerror(void)
> {
> printf("oracle error...\n");
> exit (-1);
> }
>
> int main(void)
> {
> exec sql begin declare section;
> char db_conn[30];
> exec sql end declare section;
>
> printf("\nbegin program\n");
> strcpy(db_conn, "tempuser/tiger");
>
> printf("setting up sql whenever\n");
> exec sql whenever sqlerror do sqlerror();
>
> printf("connecting with string: %s\n", db_conn);
> exec sql connect :db_conn;
>
> printf("closing connection\n");
> exec sql commit work release;
>
> return 0;
> }
> /* end lttest.pc */
>
>
>
> /* proc.mk */
> include $(ORACLE_HOME)/precomp/env_precomp.mk
>
> .SUFFIXES: .pc .c .o
>
> LDSTRING=
> PRODUCT_LIBHOME=
> MAKEFILE=proc.mk
> PROCPLSFLAGS= sqlcheck=full userid=$(USERID) dbms=v6_char
> PROCPPFLAGS= code=cpp $(CCPSYSINCLUDE)
> USERID=t21609/pmdev
> INCLUDE=$(I_SYM). $(PRECOMPPUBLIC)
>
> SAMPLES=sample1 sample2 sample3 sample4 sample6 sample7 sample8 \
> sample9 sample10 sample11 sample12 oraca sqlvcp cv_demo \
> lttest
>
> CPPSAMPLES=cppdemo1 cppdemo2 cppdemo3
>
> # Rule to compile any program (specify EXE= and OBJS= on command line)
>
>
> build: $(OBJS)
> $(CC) -o $(EXE) $(OBJS) -L$(LIBHOME) $(PROLDLIBS)
>
> cppbuild:
> $(PROC) $(PROCPPFLAGS) iname=$(EXE)
> $(CCP) -c $(INCLUDE) $(EXE).c
> $(CCP) -o $(EXE) $(OBJS) -L$(LIBHOME) $(PROLDLIBS)
>
> samples: $(SAMPLES)
> cppsamples: $(CPPSAMPLES)
>
> $(SAMPLES):
> $(MAKE) -f $(MAKEFILE) build OBJS=$_at_.o EXE=$@
>
> $(CPPSAMPLES):
> $(MAKE) -f $(MAKEFILE) cppbuild OBJS=$_at_.o EXE=$@
>
> sample5:
> _at_echo 'sample5 is a user-exit demo; use a forms makefile to
> build it.'
>
> .pc.c:
> _at_echo procflags 1 - $(PROCFLAGS)
> $(PROC) $(PROCFLAGS) iname=$*.pc
>
> .pc.o:
> _at_echo procplsflags 2 - $(PROCPLSFLAGS)
> $(PROC) $(PROCPLSFLAGS) iname=$*.pc
> $(CC) $(CFLAGS) -c $*.c
>
> .c.o:
> $(CC) $(CFLAGS) -c $*.c
>
> sample6.o: sample6.pc
> $(PROC) dbms=v6_char iname=$*.pc
> $(CC) $(CFLAGS) $(PRECOMPPUBLIC) -c $*.c
>
> sample9.o: sample9.pc calldemo-sql
> $(PROC) $(PROCPLSFLAGS) iname=$*.pc
> $(CC) $(CFLAGS) $(PRECOMPPUBLIC) -c $*.c
>
> cv_demo.o: cv_demo.pc cv_demo-sql
> $(PROC) $(PROCPLSFLAGS) iname=$*.pc
> $(CC) $(CFLAGS) $(PRECOMPPUBLIC) -c $*.c
>
> sample11.o: sample11.pc sample11-sql
> $(PROC) $(PROCPLSFLAGS) iname=$*.pc dbms=v6
> $(CC) $(CFLAGS) $(PRECOMPPUBLIC) -c $*.c
>
> calldemo-sql:
> sqlplus scott/tiger _at_../sql/calldemo </dev/null
>
> sample11-sql:
> sqlplus scott/tiger _at_../sql/sample11 </dev/null
>
> cv_demo-sql:
> sqlplus scott/tiger _at_../sql/cv_demo </dev/null
>
> /* end proc.mk */
>
>
>
> /* output */
> dev_at_t51779=> lttest
>
> begin program
> setting up sql whenever
> connecting with string: tempuser/tiger
> Segmentation Fault(coredump)
>
> /* end output */
>
>
 

-- 
Senior Software Engineer
Fairway Systems, Inc.
jcann_at_fairway.com
Received on Fri Feb 13 1998 - 00:00:00 CET

Original text of this message