当前位置: 技术问答>linux和unix
关于加载模块时出现“unresolved symbol”的问题
来源: 互联网 发布时间:2016-03-12
本文导语: 大家好! 我在使用insmod装置一个Linux模块时出现了“unresolved symbol XXXXXX”这样的提示,XXXX都是我引用的Linux源代码里的头文件所提供的函数,其中一个是这样的(定义在linuxzlib.h中): ZEXTERN int ZEXPORT z...
大家好!
我在使用insmod装置一个Linux模块时出现了“unresolved symbol XXXXXX”这样的提示,XXXX都是我引用的Linux源代码里的头文件所提供的函数,其中一个是这样的(定义在linuxzlib.h中):
ZEXTERN int ZEXPORT zlib_deflate OF((z_streamp strm, int flush));
它的实现在linux/ lib/ zlib_deflate/ deflate.c中。
我使用这个函数的代码如下:
int ZEXPORT gzwrite (file, buf, len)
gzFile file;
voidpc buf;
unsigned len;
{
gz_stream *s = (gz_stream*)file;
mm_segment_t old_fs;
ssize_t count;
if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR;
s->stream.next_in = (Bytef*)buf;
s->stream.avail_in = len;
while (s->stream.avail_in != 0) {
if (s->stream.avail_out == 0) {
s->stream.next_out = s->outbuf;
old_fs = get_fs();
set_fs(get_ds());
count =write(s->gzfd, s->outbuf, Z_BUFSIZE);
old_fs = get_fs();
if (count != Z_BUFSIZE) {
s->z_err = Z_ERRNO;
break;
}
s->stream.avail_out = Z_BUFSIZE;
}
s->in += s->stream.avail_in;
s->out += s->stream.avail_out;
s->z_err = zlib_deflate(&(s->stream), Z_NO_FLUSH);
s->in -= s->stream.avail_in;
s->out -= s->stream.avail_out;
if (s->z_err != Z_OK) break;
}
s->crc = crc32(s->crc, (const Bytef *)buf, len);
return (int)(len - s->stream.avail_in);
}
请问各位高手,我这是什么地方出错了?
我在使用insmod装置一个Linux模块时出现了“unresolved symbol XXXXXX”这样的提示,XXXX都是我引用的Linux源代码里的头文件所提供的函数,其中一个是这样的(定义在linuxzlib.h中):
ZEXTERN int ZEXPORT zlib_deflate OF((z_streamp strm, int flush));
它的实现在linux/ lib/ zlib_deflate/ deflate.c中。
我使用这个函数的代码如下:
int ZEXPORT gzwrite (file, buf, len)
gzFile file;
voidpc buf;
unsigned len;
{
gz_stream *s = (gz_stream*)file;
mm_segment_t old_fs;
ssize_t count;
if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR;
s->stream.next_in = (Bytef*)buf;
s->stream.avail_in = len;
while (s->stream.avail_in != 0) {
if (s->stream.avail_out == 0) {
s->stream.next_out = s->outbuf;
old_fs = get_fs();
set_fs(get_ds());
count =write(s->gzfd, s->outbuf, Z_BUFSIZE);
old_fs = get_fs();
if (count != Z_BUFSIZE) {
s->z_err = Z_ERRNO;
break;
}
s->stream.avail_out = Z_BUFSIZE;
}
s->in += s->stream.avail_in;
s->out += s->stream.avail_out;
s->z_err = zlib_deflate(&(s->stream), Z_NO_FLUSH);
s->in -= s->stream.avail_in;
s->out -= s->stream.avail_out;
if (s->z_err != Z_OK) break;
}
s->crc = crc32(s->crc, (const Bytef *)buf, len);
return (int)(len - s->stream.avail_in);
}
请问各位高手,我这是什么地方出错了?
|
应该是没导入相应的lib