dlopen() on dolaris

Dear experts,
please help

#include <stdio.h>
#include <dlfcn.h>
#include <link.h>
#include <iostream.h>
#include<stdlib.h>
#include<errno.h>

void main() 
{
         printf("\n in the main\n");
	void *handle;
        handle = dlopen("my.so", RTLD_LAZY);
	
        if( handle == NULL )
       {
          printf("errno[%d], errmsg[%s]\n", errno, dlerror());
          exit(1);
        }
     else
     {
          printf("\n loaded successfully");
     }
}

when i execute this file i am getting

errno[0], errmsg[ld.so.1: ./sotest: fatal: relocation error: file /user/vpp/Sun64/sys/libodl.so: symbol __1cDstdDcin_: referenced symbol not found]

even though that so is working fine in some other application i am just trying to check with other SOs which were having some problem but my working so is also showing some problem like what is the reason, please inform how to solve this problem

It is complaining about not finding a stub - resolution to external reference inside the library. Normally when you create homegrown libraries you put all your entry points and their code into the one library, so dl does not have to guess what/where a symbol is.

This is the same idea as linking because what your are doing is linking at runtime.

Plus. You also appear to be running a C module against C++ definitions/libraries. This is not easy to do: C++ often mangles symbol names - example: prepends "__ " to the symbol name above.

One last point - never use void main() - it is int main()
UNIX expects you to return a numeric value - unsigned int 0-255 from a C program.
When main is void _start() (the code that runs main) returns whatever junk it finds on the stack. This may seem trivial, but it is actually important.