Create class at run time

This is a discussion on Create class at run time within the A Brief History of Cprogramming.com forums, part of the Community Boards category; Is there someone who knows how to construct classes at run time from scratch, not at compile time? With other ...

  1. #1
    Registered User
    Join Date
    Apr 2002
    Posts
    2

    Unhappy Create class at run time

    Is there someone who knows how to construct classes at run time from scratch, not at compile time?
    With other words, we give a function some arguments; say name, functions member names, data member names, and the function will create the class from these arguments and return a pointer where the class is.
    Is there any way to construct or create such a class at run time using either C or C++ or maybe mixing with assembly language?

  2. #2
    Used Registerer jdinger's Avatar
    Join Date
    Feb 2002
    Posts
    1,065
    Shouldn't this be in the C++ forum?

  3. #3
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,386
    The question seems language independent, so I think it's valid being at the GD.

    You could define a structure with a dynamically created array with function pointers and some pointers to arrays with variables. You can't fill in the functions from scratch.

  4. #4
    Registered User
    Join Date
    Apr 2002
    Posts
    2

    Thanks for replay.

    Thank you for replay.
    I have tried to write the new class (which I created from scratch at run time) to a file and compile it at run time by invoking the compiler on that file to make an object file and put the new object in a library. But I do not know how to use the new created class from this library. How can I use this class at run time? How to calculate the relocation addresses if I load the class into the heap for example?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 03:39 PM
  2. Creating a database
    By Shamino in forum Game Programming
    Replies: 19
    Last Post: 06-10-2007, 02:09 PM
  3. Need help with time
    By Gong in forum C++ Programming
    Replies: 7
    Last Post: 01-11-2007, 02:43 PM
  4. Average asymptotic run time?
    By Ariod in forum C Programming
    Replies: 1
    Last Post: 08-03-2005, 07:47 PM
  5. The space time continueimnms mm... (rant)
    By Jeremy G in forum A Brief History of Cprogramming.com
    Replies: 32
    Last Post: 06-27-2004, 02:21 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21