dynamic library - Illegal Instruction with strcpy()
From: Nguyen (dung_at_rodan.pl)
Date: 08/24/04
- Next message: Måns Rullgård: "Re: dynamic library - Illegal Instruction with strcpy()"
- Previous message: QNils_O=2E_Sel=E5sdal=22?=: "Re: amd64 - strange behavior in simple C application - malloc() issue?"
- Next in thread: Måns Rullgård: "Re: dynamic library - Illegal Instruction with strcpy()"
- Reply: Måns Rullgård: "Re: dynamic library - Illegal Instruction with strcpy()"
- Reply: QNils_O=2E_Sel=E5sdal=22?=: "Re: dynamic library - Illegal Instruction with strcpy()"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 24 Aug 2004 04:13:44 -0700
We have a problem with using dynamic library in SuSE
(SuSE Linux Enterprise Server SLES 8 kernel 2.4.19)
We wrote a sample dynamic library with a function:
/* suse_api.c: Global functions for Library */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "suse_api.h"
int suse_strcpy(char* str_dst, char* str_src)
{
strcpy(str_dst, str_src);
return 0;
}
And a sample aplication to test the library
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "suse_api.h"
int main(int argc, char **argv)
{
char str_src[40];
char str_dst[40];
strcpy(str_src, "OK");
strcpy(str_dst, "");
suse_strcpy(str_dst, str_src);
printf("%s.\n", str_dst);
return 0;
}
And the make script
#!/bin/sh
set -e #stop if error occurrs
echo "Building testing library on SuSE/LINUX ..."
gcc -Isrc -c src/suse_api.c -o suse_api.o
gcc -Isrc -c src/suse_test.c -o suse_test.o
ld -dy -G suse_api.o -lc -lnsl -o libsuseapi.so
cp libsuseapi.so /home/myuser/lib
gcc -L/home/myuser/lib suse_test.o -lsuseapi -o suse_test
rm *.o
We get error: Illegal Instruction when trying to run ./suse_test
Can someone help us?
Many thanks.
- Next message: Måns Rullgård: "Re: dynamic library - Illegal Instruction with strcpy()"
- Previous message: QNils_O=2E_Sel=E5sdal=22?=: "Re: amd64 - strange behavior in simple C application - malloc() issue?"
- Next in thread: Måns Rullgård: "Re: dynamic library - Illegal Instruction with strcpy()"
- Reply: Måns Rullgård: "Re: dynamic library - Illegal Instruction with strcpy()"
- Reply: QNils_O=2E_Sel=E5sdal=22?=: "Re: dynamic library - Illegal Instruction with strcpy()"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|