Skip to content

Instantly share code, notes, and snippets.

@mike-zhang
Created June 27, 2016 03:11
Show Gist options
  • Save mike-zhang/220c8c1cc144763379c6e193e7379cb4 to your computer and use it in GitHub Desktop.
Save mike-zhang/220c8c1cc144763379c6e193e7379cb4 to your computer and use it in GitHub Desktop.

Revisions

  1. Mike_Zhang created this gist Jun 27, 2016.
    30 changes: 30 additions & 0 deletions getSoFuncsCommon.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    #! /usr/bin/env python
    # -*-coding:utf-8 -*-

    """
    compare so files funcs
    test pass : centos6.4_x64
    e-mail : [email protected]
    """
    import os

    def getFuncNames(iterObj,refList):
    for line in iterObj:
    arr = line.strip().split(" ")
    refList.append(arr[-1])

    def getData(cmd,refList):
    rows = os.popen(cmd).read().split("\n")
    getFuncNames(rows,refList)

    mysqlList = []
    odbcList = []

    getData("nm /usr/local/mysql/lib/libmysqlclient.so.18",mysqlList)
    getData("nm /usr/lib/libodbc.so.2",odbcList)

    #set([12,3]) & set([1,3])
    result = list(set(mysqlList) & set(odbcList))
    for item in result :
    print item