Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

strcmp in kernel

893 views
Skip to first unread message

tbe...@algonet.se

unread,
Aug 21, 1999, 3:00:00 AM8/21/99
to
I can't use strcmp in my device driver even if i include
<linux/string.h>. The compiler says implicit declaratiion
of function.
How do i use strcmp a device driver?

- David Belius

Peter Pointner

unread,
Aug 22, 1999, 3:00:00 AM8/22/99
to

strcmp might be defined as inline function. Use at least
gcc -O when compiling your driver to make the inline functions
work.

Peter

ellis

unread,
Aug 25, 1999, 3:00:00 AM8/25/99
to
In article <37be894...@news.algonet.se>, <tbe...@algonet.se> wrote:
>I can't use strcmp in my device driver even if i include
><linux/string.h>. The compiler says implicit declaratiion
>of function.
>How do i use strcmp a device driver?

Have you looked at linux/string.h? It's certainly prototyped in the
mine:

extern int strcmp(const char *,const char *);

Perhaps you are actually using the right file?

--
http://www.fnet.net/~ellis/photo/linux.html

Peter Samuelson

unread,
Aug 25, 1999, 3:00:00 AM8/25/99
to
[tbe...@algonet.se]

> > I can't use strcmp in my device driver even if i include
> > <linux/string.h>. The compiler says implicit declaratiion of
> > function.
> > How do i use strcmp a device driver?
[Peter Pointner <pe...@wuzel.m.isar.de>]

> strcmp might be defined as inline function. Use at least gcc -O when
> compiling your driver to make the inline functions work.

Yes, you do need -O or -O2 due to inlines, but if that were the problem
it wouldn't show up until link time (i.e. insmod time), I believe.

My theory is that you're not using the right kernel header files. You
need to use "-I/usr/src/linux/include" or wherever your kernel source
tree resides. Once upon a time you could omit that flag because
/usr/include had symlinks for the necessary directories, but if you use
libc6 you may well have real directories there instead, populated by
glibc's version of the kernel headers.

--
Peter Samuelson
<sampo.creighton.edu!psamuels>

Peter Pointner

unread,
Aug 27, 1999, 3:00:00 AM8/27/99
to
Peter Samuelson <pe...@zeus.niar.twsu.edu> wrote:
> [tbe...@algonet.se]
>> > I can't use strcmp in my device driver even if i include
>> > <linux/string.h>. The compiler says implicit declaratiion of
>> > function.
>> > How do i use strcmp a device driver?
> [Peter Pointner <pe...@wuzel.m.isar.de>]
>> strcmp might be defined as inline function. Use at least gcc -O when
>> compiling your driver to make the inline functions work.

> Yes, you do need -O or -O2 due to inlines, but if that were the problem
> it wouldn't show up until link time (i.e. insmod time), I believe.

Thank you for correction. I always think people should read the question
before they answer. Apparently 4 lines were to much for me.

Sorry,
Peter

[better answer snipped]


0 new messages