"Genady Beryozkin" <GenadyBeryozkin@discussions.microsoft.com> wrote in
message news:681EB440-1CA2-4535-8159-02A87EE476B1@microsoft.com...
[color=blue]
> I escape the dll initialization functions with an #pragma unmanaged
> section.[/color]
Don't use #pragma unmanaged - functions that should be compiled to native
code should end up in files compiled without /clr
[color=blue]
> I now got it work with few of our dlls (many other dlls remain native),
> making the InitInstance() methods to compile as managed code. The
> application starts fine, but I get problems at shutdown.[/color]
Restart the whole VC8 -> VC8 with /clr process again. Do not compile any
existing file with /clr. Add a new emptry file compiled with /clr. Even
though it is empty it ensures that the linker creates a mixed code assembly.
Test this assembly regarding startup and shutdown issues. Add managed code
in the new file.
[color=blue]
> Yet, I'm still not
> sure whether what I did is right or just works by chance.
> I'm not in the office right now (will be back only next week) so I can't
> tell exactly was the error message is, but it is some kind of assertion in
> the VC's own MFC/ATL code.[/color]
Please send me the callstack you see when the assertion occurs. I would like
to use it for research purposes.
[color=blue]
> Thanks again,
> Genady
>
> "Marcus Heege" wrote:
>[color=green]
>> Can you reproduce the behavior in a simple project, created from a VC6
>> wizard, and ported to VS 2005?
>>
>> I currently do not have VC6 available.
>>
>> Another question: What files do you compile to native code and what files
>> to
>> managed code.
>>
>> Marcus
>>
>>
>> "Genady Beryozkin" <GenadyBeryozkin@discussions.microsoft.com> wrote in
>> message news:E47BF404-90BD-45CC-8788-C27E08B866A9@microsoft.com...[color=darkred]
>> > Hi guys,
>> >
>> > Thanks for your answers and I certainly do care (I took a day off
>> > yesterday,
>> > and there is a time difference).
>> > The code was originally written in VC6, later ported to VC7.1 and then
>> > to
>> > VC8.
>> > We didn't change much of it, because it just worked.
>> >
>> > Now we're considering the use of .Net in some of our modules, which
>> > raises
>> > the question of how do we initialize the module properly.
>> >
>> > I did try to compile the file that has _Module definition without /clr,
>> > but
>> > I get an assertion in a call to "new
>> > CDynLinkLibrary(AFX_EXTENSION_MODULE
>> > ....)";
>> > The AFX_EXTENSION_MODULE constant is defined in the same file, and
>> > therefore
>> > is should be initialized as unmanaged.
>> >
>> > Now I'm not a COM/ATL expert, so I hope to hear your advice on how to
>> > make
>> > the /clr introduction most smoothly.
>> >
>> > Specifically - should the new CDynLinkLibrary(...) call be made from
>> > managed
>> > or unmanaged code?
>> > What about InitInstance()/ExitInstance() methods?
>> >
>> > Thanks again for your help,
>> > Genady
>> >
>> > "Marcus Heege" wrote:
>> >
>> >> Hi Genady,
>> >>
>> >> Please tell us something more about your question, especially what
>> >> version
>> >> of Visual C++ you are using.
>> >>
>> >> This allows us to give you a more precise answer.
>> >>
>> >> Thanks
>> >>
>> >> "Genady Beryozkin" <GenadyBeryozkin@discussions.microsoft.com> wrote
>> >> in
>> >> message news:AFCA9669-87D9-487E-923E-7C450C9AAF39@microsoft.com...
>> >> > Hi,
>> >> >
>> >> > I've read the article at
>> >> >
http://msdn2.microsoft.com/en-us/library/ms235211.aspx
>> >> > about how to compile MFC/ATL code, but I still have one question
>> >> > unanswered:
>> >> >
>> >> > Should I have the
>> >> > CComModule _Module;
>> >> > definition and the
>> >> > CInitInstance()
>> >> > code compiled as manages or as unmanaged code?
>> >> >
>> >> > Thanks for any help,
>> >> > Genady[/color][/color][/color]