| |
Welcome to the dBforums forums.
You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!
If you have any problems with the registration process or your account login, please contact contact support.
If you prefer not to see double-underlined words and corresponding ads, place your cursor here for ContentLink opt out.
|
 |

11-27-07, 07:40
|
|
Registered User
|
|
Join Date: Nov 2007
Location: Pretoria, South Africa
Posts: 3
|
|
|
PSQL segmentation Fault when calling BTRVID
|
Good day all,
I joined this list in the hope of getting some assistance with Pervasive BTRIEVE.
The background:
I need an application that will connect to a DB2 database, and export certain tables to brieve files. The application was originally written in C on OS/2. I have now ported it to Linux using C and Pervasive Developer engine 9.50.077.002
Program Segmentation faults in first BTRV/BTRVID call...
Here is a screen dump of the Stack Trace...
Checking Btrieve Versions...
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1208097088 (LWP 28311)]
0x08eae700 in ?? ()
(gdb) bt
#0 0x08eae700 in ?? ()
#1 0x002e40e1 in __dynamic_cast () from /usr/lib/libstdc++-libc6.1-1.so.2
#2 0x004e40cb in ps::text::charset::ByteToCharConverter::getConvert er () from /usr/local/psql/lib/libpscl.so.2
#3 0x004e0252 in ps::String::internalSetTo () from /usr/local/psql/lib/libpscl.so.2
#4 0x004dbed9 in ps::String::String () from /usr/local/psql/lib/libpscl.so.2
#5 0x001627f0 in MkdeidAdmin () from /usr/local/psql/lib/libpsqlmif.so.9
#6 0x00162757 in MkdeidAdmin () from /usr/local/psql/lib/libpsqlmif.so.9
#7 0x00151311 in DBUSetInfo () from /usr/local/psql/lib/libpsqlmif.so.9
#8 0x0014d77f in mkdeID () from /usr/local/psql/lib/libpsqlmif.so.9
#9 0x0014da04 in mkdeUTF8PathID () from /usr/local/psql/lib/libpsqlmif.so.9
#10 0x00149058 in BTRCALLID () from /usr/local/psql/lib/libpsqlmif.so.9
#11 0x00148c93 in BTRCALLID () from /usr/local/psql/lib/libpsqlmif.so.9
#12 0x00147557 in BTRVID () from /usr/local/psql/lib/libpsqlmif.so.9
#13 0x08049cbd in btrvCheckStatus () at sql2btrv.c:659
#14 0x08049dc4 in main (argc=1, argv=0xbff4ade4) at sql2btrv.c:726
Any advice / guidance will be highly valued!
Thanx
Francois
|
|

11-27-07, 09:44
|
|
Registered User
|
|
Join Date: Dec 2001
Posts: 813
|
|
A few questions:
1. What Linux distribution are you using?
2. What is the actual code that's failing?
3. Does the Btrieve sample (included in the Btrieve SDK) compile and run?
__________________
Mirtheil Software
Certified Pervasive Developer
Certified Pervasive Technician
Custom Btrieve/VB development
http://www.mirtheil.com
I do not answer questions by email. Please post on the forum.
|
|

11-30-07, 12:26
|
|
Registered User
|
|
Join Date: Nov 2007
Location: Pretoria, South Africa
Posts: 3
|
|
|
PSQL segmentation Fault when calling BTRVID
|
Red Hat ES
Btrieve sample compiles and run, also test database work fine....
Here is the actual code in C:
void btrvCheckStatus()
{
BTI_BYTE btrieveLoaded = FALSE;
BTI_BYTE posBlock1[128];
VERSION_STRUCT versionBuffer[3];
BTI_WORD dataLen = 0;
BTI_BYTE keyBuf1[255];
BTI_WORD keyNum = 0;
BTI_SINT status;
BTI_SINT i;
memset(versionBuffer, 0, sizeof(versionBuffer));
dataLen = sizeof(versionBuffer);
printf("Checking Btrieve Versions...\r\n");
status = BTRVID(B_VERSION,
posBlock1,
&versionBuffer,
&dataLen,
keyBuf1,
keyNum,
(BTI_BUFFER_PTR)&clientID);
if (status == B_NO_ERROR) {
printf("Btrieve Versions returned are: \r\n");
for (i = 0; i < 3; i++) {
if (versionBuffer[i].Version != 0) {
printf(" %d.%d %c\r\n", versionBuffer[i].Version,
versionBuffer[i].Revision,
versionBuffer[i].MKDEId);
}
}
printf("\n");
btrieveLoaded = TRUE;
} else {
printf("Btrieve B_VERSION status = %d\n", status);
if (status != B_RECORD_MANAGER_INACTIVE) {
btrieveLoaded = TRUE;
}
}
}
The GPF occurs in the bold BTRVID call....
Thanx and cheers
F.
|
|

11-30-07, 15:30
|
|
Registered User
|
|
Join Date: Dec 2001
Posts: 813
|
|
If the sample code compiles and runs, then the problem is most likely in your code. One thing I notice is that you don't initialize the clientID variable.
Specifically, this code is used in the sample:
Code:
memset(clientID.networkAndNode, 0, sizeof(clientID.networkAndNode));
memcpy(clientID.applicationID, "MT", 2); /* must be greater than "AA" */
clientID.threadID = MY_THREAD_ID;
__________________
Mirtheil Software
Certified Pervasive Developer
Certified Pervasive Technician
Custom Btrieve/VB development
http://www.mirtheil.com
I do not answer questions by email. Please post on the forum.
|
|

12-03-07, 05:02
|
|
Registered User
|
|
Join Date: Nov 2007
Location: Pretoria, South Africa
Posts: 3
|
|
Hi Mirtheil,
clientId is defined as global, and initialised in the main exactly as the sample shows. I have in GDB checked that clientId actually contains all appropriate values as set in the sample.
The only thing I can think is that somehow the environment believes we are running in a full client/server setup, which I am not. My development box is where the the SDK is installed. I want to run in single machine mode with direct file access. But I am at a loss on how to check that....
thanx
Francois
|
|

12-03-07, 10:43
|
|
Registered User
|
|
Join Date: Dec 2001
Posts: 813
|
|
The interface / engine doesn't distinguish between the client/server setup and the standalone setup. At the point your application crashes, it doesn't matter when engine/client is installed.
Normally, when an application crashes, it's because of an uninitialized variable.
Just as a test, what happens if you initialize the ClientID structure right before the Version call?
__________________
Mirtheil Software
Certified Pervasive Developer
Certified Pervasive Technician
Custom Btrieve/VB development
http://www.mirtheil.com
I do not answer questions by email. Please post on the forum.
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|