Thread: iterate through types in a library (reflection)

  1. #1
    Registered User
    Join Date
    Aug 2008

    iterate through types in a library (reflection)

    hi, i was wondering if there's a way for C++ to iterator through all types in a library.

    i understand that RTTI is not as possible as reflection in java/c#, and there are some solutions that involve macros and the like, but assuming i don't have access to the original source code, and only have static libs, is it possible for me to look at the library programmatically and determine what types there are?


  2. #2
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Portland, OR

    Long story short, it's not straightforward and not portable. One possibility is to dump the symbols from the library and demangle the names, this will at least get you the type names and method signatures of all the public types and functions in the library.
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Library Wrapper
    By cusavior in forum C Programming
    Replies: 3
    Last Post: 03-25-2008, 10:27 AM
  2. Difficulty choosing graphics library
    By jdiperla in forum Game Programming
    Replies: 11
    Last Post: 02-27-2008, 06:35 PM
  3. link with C runtime library
    By George2 in forum C++ Programming
    Replies: 26
    Last Post: 02-05-2008, 01:56 AM
  4. Global variable in shared library
    By krock923 in forum C Programming
    Replies: 5
    Last Post: 01-11-2008, 04:56 PM
  5. Network Library
    By CornedBee in forum C++ Programming
    Replies: 2
    Last Post: 05-21-2005, 09:40 PM