@Override
	public Reference addExternalReference(Address fromAddr, String libraryName, String extLabel,
			Address extAddr, SourceType sourceType, int opIndex, RefType type)
			throws InvalidInputException, DuplicateNameException {

		if (!fromAddr.isMemoryAddress()) {
			throw new IllegalArgumentException("From addresses must be memory addresses");
		}
		try {
			ExternalManagerDB extMgr = program.getExternalManager();
			ExternalLocation extLoc =
				extMgr.addExtLocation(libraryName, extLabel, extAddr, sourceType);

			removeAllFrom(fromAddr, opIndex);

			Address toAddr = extLoc.getExternalSpaceAddress();

			return addRef(fromAddr, toAddr, type, sourceType, opIndex, false, false, 0);
		}
		catch (IOException e) {
			program.dbError(e);
		}
		return null;
	}
When adding a reference on top of an existing reference, attempt to combine
the reference types giving preference to the most specific type.
@param newType the new type
@param oldType the old type
@return combined reference type, or the newType if unable to combine
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/references/ReferenceDBManager.java