Handmade Network»Forums
Shazan Shums
159 posts
Some day I will make quality software. Programming FTW.
Reverse pinvoking is it possible
I would like to crystal reports from win32 code so is it possible to reverse pinvoke or is there another report generation library for c.
Mārtiņš Možeiko
2559 posts / 2 projects
Reverse pinvoking is it possible
Edited by Mārtiņš Možeiko on
By reverse pinvoking do you mean calling managed code from native?

Yes, that is possible, but not trivial. Basically you'll need to start up .NET virtual machine set-up its environment, and then call needed functions. Here's an example how to do it: https://support.microsoft.com/en-...t-managed-method-from-native-code

Another option is to expose managed class as COM interface. And then use COM functionality in native code to call it. Here's an example how to do it: https://support.microsoft.com/en-...udio.net-or-in-visual-studio-2005 If managed library you want to call doesn't expose COM interface, you can simply write small wrapper that will do it and use managed library through this COM wrapper.
Shazan Shums
159 posts
Some day I will make quality software. Programming FTW.
Reverse pinvoking is it possible
Well it looks hard so if there any alternative for crystal reports or any report generation library in c?
Mārtiņš Možeiko
2559 posts / 2 projects
Reverse pinvoking is it possible
No idea what Crystal Reports does. Why not write data to text/binary file from your C code, and then call .NET executable to read it and do whatever you need in those Reports?
Shazan Shums
159 posts
Some day I will make quality software. Programming FTW.
Reverse pinvoking is it possible
Thanks i'll see through that.