Jump to content
View in the app

A better way to browse. Learn more.

Tuts 4 You

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How to add libs using same function names?

Featured Replies

Posted

Hi guys,

so I have a new small problem I need to fix.The problem is that I use two libs in my project and in both are some same function names used and now I get the error message...

error LNK2005: _inflateReset2 already defined in 123.lib(123.obj)
...etc

...both libs are from C dlls.

So the first question is how I can add both libs (in MASM) who using some same function names?If possible.So I dont wanna change the function names of one dll and create again a lib you know.So what can I do in that case?

Thanks

You can do this :

 
  • Pass -Bsymbolic or -Bsymbolic-functions to the linker. This has a global effect: every reference to a global symbol (of function type for -Bsymbolic-functions) that can be resolved to a symbol in the library is resolved to that symbol. With this you lose the ability to interpose internal library calls to those symbols using LD_PRELOAD. The symbols are still exported, so they can be referenced from outside the library.

  • Use a version script to mark symbols as local to the library, e.g. use something like: {local: bar;}; and pass --version-script=versionfile to the linker. The symbols are not exported.

  • Mark symbols with an approppiate visibility (GCC info page for visibility), which will be either hidden, internal, or protected. protected visibility symbols are exported as .protected, hidden symbols are not exported, and internal symbols are not exported and you compromise not to call them from outside the library, even indirectly through function pointers.

You can check which symbols are exported with objdump -T.

See here .

 

 

 

Another solution :

Wrap one or both of these static libraries in a dynamic library (.dll). Then you can change the exported names. See the full solution here .

Cheers :)

Edited by Techlord
Changed formatting

  • Author

Hi,

thanks for your answer but it dosent work to add /FORCE:MULTIPLE.So it seems I can only use both if I change these double export names + building again a new lib but this sucks as I told in my first post.Hhmm anyway.

greetz

 

Hi,

thanks for your answer but it dosent work to add /FORCE:MULTIPLE.So it seems I can only use both if I change these double export names + building again a new lib but this sucks as I told in my first post.Hhmm anyway.

greetz

One way that worked for me in the past would be to simply take a hex-editor and edit out the string references to the offending export name in one of the DLLs, to a new name.. That works for a majority of the DLLs, especially when they do not have decorated names or otehr such complications.

That would avoid having to rebuild the libraries all over again.

If you do follow this method, do remember to mark your DLL after changing the names of the exports to avoid confusion in the future !

 

Good luck :)

 

Create an account or sign in to comment

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.