public ExternalLocation addExternalFunction(Namespace namespace, String name, String address,
			SourceType type) {

		ExternalLocation result = null;

		startTransactions();
		try {
			for (Program p : programs) {

				// make sure we get the equivalent namespace for the given program
				Namespace parentNamespace = findMatchingNamespace(p, namespace);

				ExternalManager externalManager = p.getExternalManager();
				Address addr = null;
				if (address != null) {
					addr = addr(p, address);
				}
				try {
					ExternalLocation loc =
						externalManager.addExtFunction(parentNamespace, name, addr, type);
					if (result == null) {
						result = loc;
					}
				}
				catch (Exception e) {
					throw new RuntimeException("Exception adding extenal function", e);
				}
			}

			return result;
		}
		finally {
			endTransations();
		}
	}
A special test 'program-like' class that allows clients to *easily* make changes one
or more programs.  This is useful for merge tests, which need to setup an environment
that is the same for many different programs.
Ghidra/Features/Base/src/test/java/ghidra/program/database/MergeProgram.java