#include <stdio.h>
#include <stdlib.h>
#include "ld.h"

uInt32 ldFindFunc(const char *func,const char *lib) {
  int        i        = 0x0;
  uInt32    *funcPtr  = 0x0;
  ldLibrary *libPtr   = 0x0;

  libPtr = ldFindLibrary(lib); 
  if (libPtr == 0x0) {
    libPtr = ldAddLibrary(lib);
    }
  
  for (i=0x0;i<libPtr->linkerSectionHeader[libPtr->sym].shSize/sizeof(elfDynSym);i++) {
    if (!strcmp(func,(libPtr->linkerDynStr + libPtr->linkerRelSymTab[i].dynName))) {
      funcPtr = (uInt32 *)((uInt32)(libPtr->linkerRelSymTab[i].dynValue) + (uInt32)libPtr->output);
      break;
      }
    }

  return((uInt32)funcPtr);
  }

