You can. Although if the dynamic linking is done correctly that should not be necessary since the plugin should have access to all the functions of the program (check this, it is true on all desktop OS, but it may not be on ti89; PpHd should know more about this).
Well, you can. You just have to export in the main program the functions, and then import in the plugin.
All the exported functions/variables must have a name which looks like hibview__NNNN.
Where NNNN is the hexadecimal number of the exported function/variable.
To import it, just declare the function inside the plugin, just like any other function/variable. That's all.
[note]
One Unix world, Shared Linkers act exactly like static linker, ie. it uses a table of current exported symbols (symbol are refered
by string name), and when a new "object file" is loaded in the memory, all the import reference of this new object file is
solved by first checking if the symbol already exists in the current table, otherwise by looking if it is in another "shared object
file". Quite complex, very powerful, but it slows down the program a few.
On the contrary, Kernel import / export only works with "LIBNAME" + NUM. It doesn't slow down your program,
but it is less flexible (You have to rename your symbol to match the form LIBNAME__HNUM).
[/note]
The static library when it sees an import reference to a symbol of the form "LIBNAME__HNUM", first tries to resolve it inside
the current symbols, otherwise tries to look inside the static libraries. And finally, otherwise, it puts it as an import reference in
the Kernel Program. A Kernel Program can perfectly export functions/variables just like libraries.
typedef void (*myfunction_type)(char * message);
foohandle = loadlibrary("foo");
myfunction_address = (myfunction_type) getaddress(foohandle, "myfunction");
(*myfunction_address)("hello");
This explicitly loads the library, look for the "myfunction" symbol then runs it.
Or in Kernel code:
LibRef *foo = kernel__LibsBegin ("foo", 1); // Load version 1 of library foo
myfunction = kernel__LibsPtr (foo, 0); // Function 0 of library foo
(&myfunction) ("Hello");
kernel__LibsEnd (foo);
or simpler:
LibRef *foo = kernel__LibsBegin ("foo", 1); // Load version 1 of library foo
kernel__LibsCall (foo, 0, "Hello"); // Call Function 0 of library foo
kernel__LibsEnd (foo);
or even simpler:
kernel__LibsExec ("foo", 1, 0, "Hello"); // Load library, execute function and close library
Of course the libraries may be packed and compressed too (Using the compression you want).
So a good idea may be to pack the program and the plugin inside only one file. It works very fine
It works on all desktop OS.
I guess it also works with kernels such as PreOS, though you should test it or ask PpHd to be sure.

No limit. The plugin may also import at linking time another library.
The used compression may be compressed too, or use another library.
The only limit is that the linking process must be solvable, which shouldn't be a problem.