Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: "Error occur while using SQLDA and linking libsql.a in UNIX"

Re: "Error occur while using SQLDA and linking libsql.a in UNIX"

From: Kenneth C Stahl <BlueSax_at_Unforgettable.com>
Date: Mon, 20 Dec 1999 08:06:01 -0500
Message-ID: <385E29B9.86088EE4@Unforgettable.com>


oraleewk_at_my-deja.com wrote:
> My partial Makefile
> ====================
>
> .SUFFIXES: .o .cpp .PC
>
> .PC .o:
> $(PROC) $(PROFLAGS) iname=$*.PC
> $(CC) $(C++FLAGS) -c $*.cpp
>
> PROFLAGS=include=$(PCCINC) include=$(SYSINC) ireclen=255 oreclen=134
> hold_cursor=no CODE=CPP CPP_SUFFIX=cpp SQLCHECK=FULL USERID=/
>
> TARGET = dbConvert
>
> C++FLAGS = $(DEBUGFLAGS) -I./ -I$(INC) $(SYSFLAG) -I$(SYSINCPROC)
>
> all: $(TARGET)
>
> $(TARGET): $(OBJS)
> $(CC) -o $(TARGET) -L(ORACLE_HOME)/lib $(ORALIBS) $(OBJS)
> -L$(LIBS) -bloadmap:$(HOME)/CR/ld_result
>
> My partial Source code
> ======================
> #include <stdio.h>
> #include <sqlda.h>
> #include <sqlcpr.h>
>
> extern "C"
> {
> int DBLogin();
> void DBLogout();
> }
>
> EXEC SQL INCLUDE SQLCA;
> EXEC SQL INCLUDE SQLDA;
>
> extern SQLDA *sqlald();
>
> int dbCvt()
> {
> int ret_code=0;
>
> EXEC SQL BEGIN DECLARE SECTION
> VARCHAR statement[500];
> EXEC SQL END DECLARE SECTION
>
> SQLDA *s_dp;
>
> s_dp = sqlald(30, (size_t)30, (size_t)30);
> s_dp->N=300;
>
> //sqlclu(s_dp);
>
> sqlerrors:
> ret_code=(int)sqlca.sqlcode;
>
> EXEC SQL WHENEVER SQLERROR CONTINUE;
> return(ret_code);
>
> }
>
> void main(void)
> {
> int ret_code=0;
>
> ret_code = DBLogin();
>
> dbCvt();
>
> DBLogout();
> }
>
> Typo
> ======
> By the way, the last message I posted regarding to the extracted object
> file "sqlald.o", I had typo on it. Sorry.
>

I see one potential problem so let's start there.

The oracle header files do not automatically handle c++, so you must add some code to do this.
In the list of header files at the start of the program, make the following change:

#include <stdio.h>
#include <sqlda.h>
#ifdef __cplusplus

extern "C" {
#endif
#include <sqlcpr.h>
#ifdef __cplusplus

}
#endif

That should take care of the mangling problem. Try that and see what happens.

................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
vv Received on Mon Dec 20 1999 - 07:06:01 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US