Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: revanthedarth on January 28, 2011, 02:17:20 pm

Title: Dynamic Library Problem
Post by: revanthedarth on January 28, 2011, 02:17:20 pm
I have a huge project that works under Windows (VS 2008). I'm trying to port it to linux but i've encountered a problem in dynamic libraries.

I have a RendererOpenGL project that creates RendererOpenGL.so. But i cannot open that file using the code below:
Code
#include <dlfcn.h>
#include <cstdio>
int main()
{
void* libHandle;
libHandle=dlopen("./RendererOpenGL.so", RTLD_LAZY);
if(!libHandle)
{
printf("PROBLEM OPENING SO FILE!\n");
return 0;
}
printf("Bye...\n");
return 0;
}

I tried adding -shared to compiler flags or linker options, but nothing changed. And dlopen('RendererOpenGL.so", RTLD_LAZY) doesnt work either. I guess there is something wrong in the configuration.
Title: Re: Dynamic Library Problem
Post by: ollydbg on January 28, 2011, 02:22:05 pm
this question is not related to C::B, so I think you'd find a better forum to ask there.
Title: Re: Dynamic Library Problem
Post by: revanthedarth on January 28, 2011, 02:25:09 pm
It is. Creating a shared object works fine if i use g++ with -shared flag. But when I create a Dynamic Library with C::B, it doesn't create a valid output.
Title: Re: Dynamic Library Problem
Post by: Jenna on January 28, 2011, 02:30:41 pm
It is. Creating a shared object works fine if i use g++ with -shared flag. But when I create a Dynamic Library with C::B, it doesn't create a valid output.
Believe me it works if the settings are correct.
Try the dynamic library wizard and compare the settings with your project.
Title: Re: Dynamic Library Problem
Post by: stahta01 on January 28, 2011, 03:01:11 pm
Please read the FAQs and the posting rules
http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F
http://wiki.codeblocks.org/index.php?title=FAQ
http://forums.codeblocks.org/index.php/topic,8962.0.html
http://forums.codeblocks.org/index.php/topic,9996.0.html

Tim S.