CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10

Threaded View

  1. #1
    Join Date
    Sep 2009

    [RESOLVED] accessing symbols in appllication from within dynamic library MinGW


    I am porting an application from Linux to Windows. Since it is a GTK app most of the stuff works; I have to touch a little here and there. One problem though I cannot find the solution as it seems. The application uses a plugin system for easy expandable functionality. The interface to the plugin is very simple: an init function, a worker function, and a deinit function. The plugins shall have access to the main applicationsymbols (functions global variables). I cannot find a working (and feasible) way under Windows to make the linking work. I always get "undefined reference" errors for symbols which exist in the application.
    I am using MinGW 4.6.2.
    I made a stripped down demo application to be able to better (and faster) test the principle. I am using the dlfcn-win32 project from Ramiro Polla (http://code.google.com/p/dlfcn-win32/) for the dynamic loading stuff and it works like a charm.

    Here is the project:

    It tried a number of commandline options to the linker for the application (--export-all-symbols, --export-dynamic, -rdynamic (apparently not supported in MinGW)) as well as for the shared objects (--allow-shlib-undefined, --enable-auto-import, --enable-runtime-pseudo-reloc).

    As you can see in the provided makefile under Linux it is just "-shared" for the .so. Under Mac OS X (Darwin) it is "-bundle -bundle_loader <app name>".

    I googled a lot but most of the suggested solutions just did not work. Either it is a different configuration / environment or I must have overlooked something.

    Does anyone here know how to do this and if it is even possible in Windows?

    Many thanks in advance!


    Here is a .zip archive of the dlfcn stuff with modified makefile, which works on the cmd.exe command prompt; MSYS is not required. Just adjust the MinGW installation path in config.mak and type 'make" and 'make install'.

    Thanks for your efforts,
    Last edited by johanneshau; April 18th, 2013 at 05:18 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.