I am developing application which intend to be cross platform. I used to use Windows Messages but now I am dropping it out. I replaced messages with callbacks but regardless I can use different technologies I am not aware of different possibilites when not using windows messages.
Well I have main exe aplication and some dll plugins. I have some objects and threads in dll and I would like to notify main application about some changes that DLL made to data structure.
As I said I am currently working with some callbacks. To provide compatibility with different languages (C++, VB, C#) I have non-object type of callback. I am not sure if other languages supports callback of object.
So my questions are:
- What are the alternatives (cross-platform) to windows messages? Can callbacks replace messages?
- Do other languages support callback of object?
- I guess other languages have different technologies as alternative to messages?
Yes you can replace messages with callbacks.
You shouldn’t use object methods as callbacks. Common practice in portable code is use of handles (notify calling convention):
DLL source:
Executable source:
Edited: You can’t shoot yourself in you leg now.
OS have a few message alternatives. However not many truly portable.
You can also use: