c++cgcclinker

How to dynamically link GCC objects?


I'm unsure if the question is phrased correctly, or if what I want to is possible.

I have an existing GCC application (compiled for a Cortex-M3 if that matters). What I want to do is create a little piece of functionality (just a single method, few methods) that can call into the existing application.

I want to place these few methods at a specific memory location (I know how to do that). What I don't know how to do is get the new application to compile/link with the objects of the existing application.

For instance, my existing application has the function:

int Add(int a, int b);

And new application wants to use it:

int Calculate(int a, int b, int opType)
{
  Add(a, b);
}

I have access to all linker, obj, h files, etc.


Solution

  • Thanks for your input, however I was able to do exactly what I wanted by compiling the new application using the ELF file from the existing application has an input to the Linker by specifying
    --just-symbols elffile.elf