typedef int (*streamSize_t)(char *,tePddLocation);
typedef int (*read_datastream_t)(char *,unsigned char*, int, unsigned int, unsigned char*);
typedef int (*get_elementfromstream_t)(char *, const void*, size_t, void*, int, unsigned char);
streamSize_t streamSize;
read_datastream_t read_datastream;
get_elementfromstream_t get_elementfromstream;
char *error;
handle = dlopen ("/opt/bosch/base/lib/libpdd_so.so", RTLD_LAZY);// ./libpdd_so1.so
std::cout<<"Address"<<handle<<std::endl;
if (!handle) {
std::cout<<"error to open"<<dlerror()<<std::endl;
exit(1);
}
streamSize = reinterpret_cast<streamSize_t>(dlsym(handle,"pdd_get_data_stream_size"));
int val = streamSize("EarlyConfigTwoDisplays",a);
unsigned char *ptr = (unsigned char*)malloc(val);
memset(ptr,0x00,val);
unsigned char *ptr1 = (unsigned char*)malloc(val);
memset(ptr1,0x00,val);
unsigned char *ptr3 = (unsigned char*)malloc(32);
memset(ptr3,0x00,32);
std::cout<<"size"<<val<<std::endl;
read_datastream = reinterpret_cast<read_datastream_t>(dlsym(handle,"pdd_read_datastream_early_from_emmc"));
int return_read_datastream = read_datastream("EarlyConfigTwoDisplays",ptr,val,0x01,ptr1);
get_elementfromstream = reinterpret_cast<get_elementfromstream_t>(dlsym(handle,"pdd_helper_get_element_from_stream"));
int return_getelementfromstream = get_elementfromstream("TrTimingLVDS2",ptr,val,(void*)ptr3,32,0);
std::cout<<return_read_datastream<<" "<<return_getelementfromstream<<" "<<ptr3<<" "<<ptr1<<std::endl;
Asked
Active
Viewed 255 times
0

Alan Birtles
- 32,622
- 4
- 31
- 60

M N Adarsh Kumar
- 3
- 5
-
1I don't really see a question here. Is there a specific line of code that is producing an error message? – jkb Jun 20 '22 at 03:56
-
3The type of `"EarlyConfigTwoDisplays"` is `const char[k]` for some value `k` (I'm too lazy to count characters). Note `const`. This is convertible to `const char*`. For backward compatibility, some compilers allow an implicit conversion to `char*` (no `const`), but this is an extension to the C++ standard; the standard doesn't allow it. Your program passes a string literal to a function expecting `char*`, hence the warning. Note that, in any case, the memory occupied by a string literal is not writable. If `streamSize` expects to write to it, it's going to have a bad time. – Igor Tandetnik Jun 20 '22 at 03:56
-
@jkb read_datastream("EarlyConfigTwoDisplays",ptr,val,0x01,ptr1) here ptr1 is showing warning – M N Adarsh Kumar Jun 20 '22 at 03:58