Author Topic: C/C++ Lib Compatibility  (Read 4060 times)

Alhexx

  • *
  • Posts: 1894
    • View Profile
    • http://www.alhexx.com
C/C++ Lib Compatibility
« on: 2005-01-03 14:32:38 »
Okay, another problem for my BrutePix tool.

BrutePix is going to use DLL Plugins, and the plugins should be able to use exported functions by BrutePix.
Exporting BrutePix functions is not a problem at all.
A .lib file is created and can be imported to a Plugin.

However, the lib file is changed everytime when you recompile the Project after making a change.
So, let's say I want to update my functions from Version 1.0 to 1.1, so the lib is recompiled. The plugins won't work anymore, since they can't find the right addresses, if they have been compiled with the old lib, right?

Is there any possibility to get around this, so the old Plugins will be compatible to newer versions of the library?

 - Alhexx

Micky

  • *
  • Posts: 300
    • View Profile
C/C++ Lib Compatibility
« Reply #1 on: 2005-01-03 15:10:35 »
Did you try this? I'm at least 99.5% sure that functions are linked up by name and not by address in a DLL.

Kislinskiy

  • Guest
C/C++ Lib Compatibility
« Reply #2 on: 2005-01-03 16:38:16 »
You can be 100% sure about this.  :wink:

@ Alhexx
Also put the exported functions of BrutePix in a DLL.

Cyberman

  • *
  • Posts: 1572
    • View Profile
C/C++ Lib Compatibility
« Reply #3 on: 2005-01-03 17:03:33 »
I suggest not creating a .lib for accessing a DLL.
This can create real headaches because these force STATIC liinking.

Also for plugins you should have a set of functions that return information. Each plugin should have identically named functions in it as well. This is how I did the plugin system for PSXmemtool.

Cyb

Alhexx

  • *
  • Posts: 1894
    • View Profile
    • http://www.alhexx.com
C/C++ Lib Compatibility
« Reply #4 on: 2005-01-03 20:51:57 »
Well, okay, so there's no problem here. That's fine.

Thank you anyway.

I'll continue buggin' you as soon as I start coding again... :D

 - Alhexx

 - edit -
Cyberman: That's the way I want to realize the plugins. However, BrutePix also "serves" some functions which can be called by Plugins (to retrieve information about currently loaded file etc.), and for those I need to create a lib.

Cyberman

  • *
  • Posts: 1572
    • View Profile
C/C++ Lib Compatibility
« Reply #5 on: 2005-01-04 00:51:38 »
Quote from: Alhexx
Well, okay, so there's no problem here. That's fine.

Thank you anyway.

I'll continue buggin' you as soon as I start coding again... :D

 - Alhexx

 - edit -
Cyberman: That's the way I want to realize the plugins. However, BrutePix also "serves" some functions which can be called by Plugins (to retrieve information about currently loaded file etc.), and for those I need to create a lib.

Those are CALL BACK defined functions, you should pass those TOO the plugin then.  I've never had to do that.  Passing data between plugins is safest via a programatic interface (IE like GL passes data but without using pointers) I've always had access violation difficulties using pointers. Instead I have passed large amounts of data via the clip board. This seems to work quite fast and well.  I merely open streams to read and write the data to buffers and then paste it to the clip board using the proper windows functions.  Again this is what we ended up doing with PSXmemtool.

Cyb