First thanks for your explanation.
I have all the source code of the old dll. All the modules providing
these dll are included in my solution J#
Solution J#
Native
Module Native DLL 1
Module Native DLL 2
...
Module Native DLL 8
Managed
Module C++ Managed (Wrapper using the differents
Module Native DLL X)
And in the solution J# I import the assembly provided by the managed
code and i make an instance of it. My problem is not here but during the
execution. My idea is the Managed DLL seems to not link with the code
provided by the Native DLL Module.
I remember you the error in the Runtime :
""" An exeception of type 'System.IO.FileNotFoundException' is done in
the MAIN.exe (program J#)
The file or the assembly named DLLModuleManagedMixedC++ or one of its
dependances are not found. """
To answer your questions :
Lars-Inge Tønnessen [VJ# MVP] a écrit :
-----------------------------------------------------------------
1]> Not easy to say when we don't see your code. But double check that
any of
[quoted text, click to view] > your code does not hard code any paths to any dlls. Eg in the managed C++
> part.
>
Yes i know it's difficult without the code but i can't show you the code
because it's a commercial project.
But what do you mean with "hard code any paths to any dlls" ?
2]> Search through all your dll projects to locate any CRT sections. Can
you
[quoted text, click to view] > locate them?
>
I can find all the CRT section in the native dll code but i don't want
to touch this code (it's a big project that i've to include in my
project). I can only work at the level of the Wrapper managed Module.
[quoted text, click to view] > Using a managed C++ dll in J# is like using any other .NET dll. Make a
> reference (in the menu: "project" + "Add Reference...") to the dll-file and
> make an instance of it, and do method calls.
>
Yes it's already done (see previous explanations)
[quoted text, click to view] >
> Do you have the source code for the old C++ dlls ? Would it be hard to
> convert it into a ATL C++ COM components? If you can convert it (the old C++
> code) into a COM component you can drop the managed C++ layer. It's very
> easy to reference and use a COM component in J#.
>
>
Yes i have the source code but like i said i don't want to modify hardly
the dll code. I can make some small modification but not converting them
in ActiveX.
Moreover i don't know how to do it and will take me too much time to do
it (it's a commercial project so i have deadlines !)
[quoted text, click to view] > Are you able to show us a small code sample of your code ?
No sorry. I can only say you that the DLL Native C++ comes from a
project of ten years (so you can easily understand that i don't want to
modify it !).
But in fact, first I only want to know how to use old DLL ( Entry point
etc..) in a mixed managed C++ Module. I have seen an example on the
microsoft MSDN called MCppWrapper.
First when i compile the Microsoft code directly i've got this warning
LINK : warning LNK4243: DLL containing objects compiled with /clr is not
linked with /NOENTRY; image may not run correctly
To understand how it works, I've only duplicated the code in the native
C++ (the same code but i only rename the substring class with
mysubstring and i've done the same thing in the Managed mixed module (i
create a new __gc class) but i got
Exception 'System.StackOverflowException' in test.dll done by this line
char * in_string = new char[length+1];
Thanks in advance.
[quoted text, click to view] >
>
> Regards,
> Lars-Inge
>
>