handmade.network » Forums » Reverse pinvoking is it possible
msmshazan
Shazan Shums
162 posts

Some day I will make quality software.
Programming FTW.

#11758 Reverse pinvoking is it possible
6 months ago

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.

Just being curious on programming....
mmozeiko
Mārtiņš Možeiko
1485 posts
1 project
#11759 Reverse pinvoking is it possible
6 months ago Edited by Mārtiņš Možeiko on April 25, 2017, 4:14 a.m.

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.
msmshazan
Shazan Shums
162 posts

Some day I will make quality software.
Programming FTW.

#11762 Reverse pinvoking is it possible
6 months ago

Well it looks hard so if there any alternative for crystal reports or any report generation library in c?

Just being curious on programming....
mmozeiko
Mārtiņš Možeiko
1485 posts
1 project
#11767 Reverse pinvoking is it possible
6 months ago

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?
msmshazan
Shazan Shums
162 posts

Some day I will make quality software.
Programming FTW.

#11769 Reverse pinvoking is it possible
6 months ago

Thanks i'll see through that.

Just being curious on programming....