PIC32 running a program from RAM
Both the longramfunc and ramfunc attributes place the function in a special area of flash that will be copied to RAM by the startup code.  You don't want to use them.

For functions which will be called from flash, you want to use the longcall attribute which specifies that a 32-bit call (JALR) is needed instead of a 28-bit call (JAL), since flash and RAM are located in separate 512MB segments. 

You will also need to set up a custom linker file with an executable RAM section, and include that section name on every function that is placed there. 

The longramfunc macro also includes the longcall attribute, whereas the ramfunc macro does not, and is intended for calls from one RAM function to another.  In your case, for functions called by other RAM functions, you do not want to use the ramfunc attribute because it sets up the copy from flash.

Since you will be copying the functions yourself (e.g. off of an SD card), you will need to include your own loader that interprets the hex code and copies the data to flash as needed.