scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

getsym.c (322B)


      1 #include <stdio.h>
      2 
      3 #include <scc/mach.h>
      4 
      5 #include "libmach.h"
      6 
      7 #include "elf/fun.h"
      8 #include "coff32/fun.h"
      9 
     10 static Symbol *(*ops[NFORMATS])(Obj *, int *, Symbol *) = {
     11 	[COFF32] = coff32getsym,
     12 	[ELF] = elfgetsym,
     13 };
     14 
     15 Symbol *
     16 getsym(Obj *obj, int *index, Symbol *sym)
     17 {
     18 	return (*ops[objfmt(obj)])(obj, index, sym);
     19 }