dmidecode-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [dmidecode] custom dmidecode


From: Jean Delvare
Subject: Re: [dmidecode] custom dmidecode
Date: Thu, 12 May 2011 15:10:25 +0200

On Thu, 12 May 2011 18:18:45 +0530 (IST), Prashant Saxena wrote:
> Hi,
> 
> ubuntu 8.04 LTS hardy
> gcc version 4.2.4
> 
> 
> I am creating a small utility to get system info. I am using ripped version 
> of 
> dmidecode 2.11.

Duplicating code is usually a bad idea. You are likely to miss later
bug fixes. You'd rather rely on the command line interface of dmidecode
is possible, or link with libsmbios.

> While compiling I am getting an error in main function:
> 
>  error: invalid conversion from ‘void*’ to ‘u8*’
> 
> The reason being is that in main buf is defined as 'u8' type
>     u8 *buf;
>        ....
>    if ((buf = mem_chunk(fp, 0x20, opt.devmem)) == NULL)
>    
> where as mem_chunk return a void pointer
> 
> Any pointers? I am not well verse in using c/c++

Converting to/from void pointers is supposed to be always OK. I presume
you're explicitly passing a compilation flag to gcc (or whatever you're
using) to make it treat this as an error. Maybe -Wc++-compat?

Either stop using this compilation flag, or just explicitly cast the
result of mem_chunk() to u8 *.

-- 
Jean Delvare



reply via email to

[Prev in Thread] Current Thread [Next in Thread]