Closed haller9816 closed 5 years ago
Well, after you, I was already thinking about this :) Probably this is really good idea to aggregate different ideas for beginners and not only!
But, Olaf, about #83, you already have a working export and moreover its successful importing too on C++.
Thus, your problem may be exactly from logic of using your mentioned "the Neural Networks" library: incorrect initialization, invalid data, or even null and the related unhandled exception from managed side, stack corruption, stack overflow, and lot of other bugs.
For example, I'm seeing that you have Unhandled exception (KernelBase.dll) when calling at specific non-zero addr. Therefore you need to inspect data and internal logic of your called function. You need to debug this yourself or provide this for someone to help with debugging of your 3rd-party code.
Can you provide this project for debug?
Or try to add try/catch for catching possible exceptions in managed side, if it's not a stack or some internal problems with marshaling, probably will help.
About some complete examples, I'll review this soon! Stay in touch.
Hi Denis, hi all,
good to know that I inspire you. First I thought my issue was to naive :-) . But you had an interesting idea. I think more people like me need to share managed and unmanaged code and have such a problem. And thank you for your effort.
But in the terms of my example. I don't think, it's because of the calling of the 3rd-party-dll. In a stand allown program it works (see attachment).
Thank you for all of your help.
Olaf
ps: the debugging of the mixed language dosn't work
and no. in my old task only the compiling worked, not the export
@haller9816 I'm starting new repo - https://github.com/3F/Examples
Through complete examples, this repository should provide more related support of various using of some solutions and public projects, or more.
I general, this repository will contain complete examples for various projects like: DllExport, Conari, GetNuTool, vsSolutionBuildEvent, MvsSln, ...
This already contains complete example for you:
and no. in my old task only the compiling worked, not the export
You have address of found exported function by GetProcAddress()! Therefore, you have a working dll-importing from .net library. Otherwise it should return NULL. Check this out.
p.s. *Denis (Денис), not a Dennis.
Hi Denis (исвений неправильно написание имя или имени),
thank you very much for these examples. I will try this in a few days. You made this in VB -- special thank
Олаф
Well, the main logic of the BasicExport example was written on C++ (as unmanaged part).
.net libraries via C# and VB.NET just contains something for demonstration of work.
But, now you can also try this for your real library, like:
PEModule lib(_T("Path_to_your_Library.dll"));
double result = lib.call<double>("Netz", 24.781);
I also configured debugging as mixed type via .user file specially for you (usually these are ignored files for SCM). Now, just add breakpoint in your managed function on vb.net, and press F5
I also added some try/catch handling for system errors. Now it can be more clearly with your problem.
@3F Hi Денис, sorry for my bad Russian. This should be a try and a little fun. But thank you for the corrections. You did really a lot of effort. Even in the debugging with mixed language. Thanks a lot. Next weekendend I hope to have more spare time to try all your help.
Олаф
Hi Denis, hi all,
sorry again. As you know I have my problems with the C++/VB.NET solution with DLLExport (and with the C++ language per se and how it looks wit VB.NET and C#.NET). I really tried it a long time. Now I hope by going onother way I can produce a running solution.
Do you have a complete (and simple) project with source (C++/C#) codes with using DLLExport? Here I could find only program pieces and the screencast, where I don't know, what is important.
Or did I missed something?
I'm really better in mathematical and technical calculations than in programming. For the science things my expiriences in programming with Fortran were enogh, but here I find my limits,
Olaf