@Override
	ExternalLocation createExternalFunction(ProgramDB program, String transactionDescription,
			String library, String label, String addressAsString, SourceType sourceType) {
		Address address = (addressAsString != null) ? addr(program, addressAsString) : null;
		int txId = program.startTransaction(transactionDescription);
		boolean commit = false;
		ExternalManager externalManager = program.getExternalManager();
		try {
			SymbolTable symbolTable = program.getSymbolTable();
			Library externalLibrary;
			Symbol librarySymbol =
				symbolTable.getSymbol(library, Address.NO_ADDRESS, program.getGlobalNamespace());
			if (librarySymbol != null && librarySymbol.getSymbolType() == SymbolType.LIBRARY) {
				externalLibrary = (Library) librarySymbol.getObject();
			}
			else {
				externalLibrary = symbolTable.createExternalLibrary(library, sourceType);
			}
			ExternalLocation externalLocation =
				externalManager.addExtFunction(externalLibrary, label, address, sourceType);
			assertNotNull(externalLocation);
			commit = true;
		}
		catch (Exception e) {
			Assert.fail(e.getMessage());
		}
		finally {
			program.endTransaction(txId, commit);
		}

		assertTrue(externalManager.contains(library));
		ExternalLocation externalLocation =
			externalManager.getUniqueExternalLocation(library, label);
		assertNotNull(externalLocation);
		assertEquals(true, externalLocation.isFunction());

		assertEquals(library + "::" + label, externalLocation.toString());
		assertEquals(address, externalLocation.getAddress());
		assertTrue(externalLocation.getSource() == sourceType);
		DataType extDataType = externalLocation.getDataType();
		assertNull(extDataType);
		Function function = externalLocation.getFunction();
		assertNotNull(function);
		assertEquals(0, function.getParameterCount());
		return externalLocation;
	}
@param program
@param transactionDescription
@param library
@param label
@param addressAsString
@param sourceType
@return
Ghidra/Features/Base/src/test.slow/java/ghidra/app/merge/listing/ExternalUseForAllTest.java