-
-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem with parameters #166
Comments
I'm not sure what are you trying, but, I'm watching IUnknown interface in your src. Is there any reason why not to make it initially as COM visible component if you've plan to use this anyway? Or try this if you just need complex types etc.
In any case, our tool is configured for __cdecl by default [?] |
Thank you for your answer. What I'd want to do i substitute an old c++ dll, that exports the ItfNavig I put in the example (not INavig, that was a typo cleaning the code) with a new c# managed dll.
in c++ it should become
But this is not my case and the reason of the exception. As I can't change the c++ interface, to solve it has been sufficient tell to c# to not change the signature, so in c# the method changes in
And all worked fine. I hope this can be useful to someone else |
All correct. We need to use PreserveSig to avoid mentioned transformation in COM interop. Otherwise you can also try with some offset to the specific field like ~ Moreover, in past, I already voiced about hack with offsets for IUnknown 3F/Conari#8 when raw access to data 3F/Conari#2 (comment) That can be considered in the manner of Conari: https://github.com/3F/Examples/blob/master/DllExport/BasicExport/UnmanagedCppConsole/UnmanagedCppConsole.cpp#L59 and so on
Yes! Thank you for the tips in our Q&A list. |
From a c++ program I want call some functions of an interface into a managed class library in c#. The call works but I got an exception when the caller exit from the function and it happens only if and when the called function has a parameter. I think this is related to the calling convention stdcall, but I can't figure out how to correctly configure the interfaces. May you give me an hint? Thank you
This is the calling c++ part
Interface
This is the call
This is how it is implemented in c #
DllExport
The Interface
and the implementation
The text was updated successfully, but these errors were encountered: