Hello Experts,
I am using TAO3530 having TI OMAP 3530 processor with Tsunami Basebaord form TechNexion. I have created a custom rootfs using buildroot but I am using their kernel image.
I have cross-compiled a simple "Hello World" program using "arm-buildroot-linux-uclibcgnueabi-gcc" which executed flawlessly on target board but when I am trying to execute a cross-compiled application to print the value of Cosine of 2
the program is not getting executed, infact I am not getting any error or output.
The program is:
Code:
#include <stdio.h>
#include <stdlib.h>
#include <dlfcn.h>
int main(int argc, char **argv)
{
void *handle;
double (*cosine)(double);
char *error;
handle = dlopen("libm.so", RTLD_LAZY);
if (!handle)
{
fprintf(stderr, "%s\n", dlerror());
exit(EXIT_FAILURE);
}
dlerror(); /* Clear any existing error */
/* Writing: cosine = (double (*)(double)) dlsym(handle, "cos");
would seem more natural, but the C99 standard leaves
casting from "void *" to a function pointer undefined.
The assignment used below is the POSIX.1-2003 (Technical
Corrigendum 1) workaround; see the Rationale for the
POSIX specification of dlsym(). */
*(void **) (&cosine) = dlsym(handle, "cos");
if ((error = dlerror()) != NULL)
{
fprintf(stderr, "%s\n", error);
exit(EXIT_FAILURE);
}
printf("The COSINE of 2.0 is %f\n", (*cosine)(2.0));
dlclose(handle);
exit(EXIT_SUCCESS);
}
I am not getting any idea why programs which are using libdl and dlopen, dlcolse are not getting executed but the same program is getting executed on HOST.