Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 465905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T23:25:30+00:00 2026-05-12T23:25:30+00:00

This is going to sound super hackish but does anyone know of a way

  • 0

This is going to sound super hackish but does anyone know of a way to combine method bodies at runtime in C++? I’m currently on the path of grabbing the address of the functions then memcopy to executable memory but it has the problem of unwanted prolog/epilog.

Essentially I’ve got a few dozen simple operations that take the same arguments and return nothing and i want to build a function at runtime out of these simple operations.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T23:25:30+00:00Added an answer on May 12, 2026 at 11:25 pm

    I can’t see any practical use for this, except for the heck of it 🙂

    So first you should decide for a platform.
    There is no way in hell you can do this in a cross-platform way.
    It might actually be quite difficult to do it in a way that works across several compilers, even on the same platform.
    Then the processor type, of course 🙂

    Then you should somehow check that the code you are copying can be relocated. Not everything can be moved around as you feel like.

    You have to understand very well the calling conventions, so that you make sure you don’t mess up the stack.

    Know how the prolog/epilog generated by your compiler. You can probably cheat by adding at the beginning and end of the functions some code sequences that does nothing, but you can use as signature then look for (ie. nop; nop; nop; xor ax, ax; nop; push ax; pop ax; nop; nop; nop; ). Make sure is not optimized-out by the compiler 🙂

    Make sure you can write/execute that code. The modern CPUs and OSes don’t normally allow one to write in a code segment, or to execute a non-code segment. So you will have to find out what are the ways to change the rights (100% OS specific).

    Then have fun fighting stuff like “Address space layout randomization,” “Stack Randomization,” “Data Execution Prevention,” “Heap Randomization.”

    Anyway, a lot of work. And pointless, except to enjoy a good challenge and in the process learn some assembly and OS internals.
    Or for proving yourself as “1337,” but then, asking on stackoverflow how to do it is not quite “1337,” if you ask me 🙂

    Anyway, good luck.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok I know this is going to sound weird but it is what the
I know this question is going to sound very stupid but here goes nonetheless.
Okay, I know this is going to sound like homework; but here goes any
I know I am going to sound very noobish for asking this question BUT
I know this is going to sound like a dumb question, but as I'm
I know this is going to sound silly but I can't find what's wrong.
I know this is going to sound silly but I cannot for the life
Firstly, this is going to sound like homework, but it ain't. Just a problem
Ok this is going to sound strange, but I have inherited an app that
All right, this one is going to sound very weird and I don't know

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.