1. 28
  1. 5

    This code is such a bad idea, I’ve intentionally introduced errors so it won’t even compile.


    1. 3

      That story is hilarious. That anyone would have gone down the path to implement this functionality without knowing about what DLLs do….

      Having said that, I’ve copied code using memcpy() in the past. This was on a 32-bit ARM platform, for re-programming the flash memory of the main program from a bootloader. This was necessary because you couldn’t access (or execute code out of) a region of flash memory when programming it, even if you weren’t erasing the sector or bank that had the bootloader code in it. So we went through the whole process of looking through the generated assembly to make sure it was OK. We didn’t use anything on the stack, or even local variables, instead hardcoding absolute memory addresses for vars.

      1. 1

        I suppose instead of reviewing the assembly, one could use a separate link section, such that you can specify the load address in the linker script.

      2. 1

        We never heard back from the customer.

        And then, in the future, Chrome and Firefox began applying aggressive anti-anti-virus techniques.