linking c++ file with a .so file

I am trying to wrap an existing API with my API. I have written the code in C and C++ for my API and I am trying to link the code with the existing API's .so file. I tried to link it with this command "g++ -shared -Wl,-soname -o Flexash.o -DBUILD_DLL -D__linux__ -L. -lnpm" and it did create a new .so file.
But when I try to validate my code with the Python script file , I get teh following errors :

aashishr90@aashishr90-VirtualBox:~/Documents/NpmAbsDll$ python
Lib name: '/home/aashishr90/Documents/NpmAbsDll/'
Traceback (most recent call last):
File "", line 652, in <module>
File "", line 608, in main
sp_obj = TM_SP_Cmds(sp_dll_name)
File "", line 51, in __init__
self._initialize(*args, **kwargs)
File "", line 80, in _initialize
fail_status = self.SP_DLL.Initialize(ports_buf, status_buf)
File "/usr/lib/python2.7/ctypes/", line 378, in __getattr__
func = self.__getitem__(name)
File "/usr/lib/python2.7/ctypes/", line 383, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /home/aashishr90/Documents/NpmAbsDll/ undefined symbol: Initialize
Exception AttributeError: '/home/aashishr90/Documents/NpmAbsDll/ undefined symbol: Unload' in <bound method TM_SP_Cmds.__del__ of <__main__.TM_SP_Cmds object at 0x7f4353689ed0>> ignored

I doubt whether the functions in my API are getting exposed. Kindly provide me a solution ofr this.

Try supplying an "soname" to the linker:
g++ -shared -Wl, -o Flexash.o -DBUILD_DLL -D__linux__ -L. -lnpm

Or remove "-Wl,-soname"
Topic archived. No new replies allowed.