What's wrong with this C code solved

Yeah !! Horns uff ... that was a hacked ^^
My biggest problem was how do I get the unmanaged data types into managed code.
It's a bit complicated to explain now, but after a while on Google I found this:
Shit, can't find the link anymore ...
Then just some code:

A wrapper class that converts unmanaged data into managed data.
I let out all my creativity and called this class "Wrapper" ...

Code: Select all

Then static wrapper wrapper; in the header (public namespace) to use the instance in the class that is used as a callback class by the library.
I don't know now whether the static is necessary ...

And then in this said callback class:

Code: Select all

And voila. Jochen was happy like anything else ...

The background should be that a C # function must always be called when values ​​change on the OPC server.
The C ++ library offers a callback class interface for this purpose; So inherit from it, implement the method, and pass an instance of the class to the library. Very easy.
But now a delegate should be called from this callback class .... and this turned out to be really difficult, since, for example, no managed class handlers or delegates are allowed in an unmanaged class. Therefore the detour via this .... well .... "pointer" (?) ... and wrappers.

Yeah Thanks again for your help...


Addendum:
I just see that I could probably have saved this static instance of the Wrapper class in the header.
I could possibly put them as a member in MyCallback.
I just wonder why I didn't do that ....:?:

CEO of Dirty codez Production®