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 13 2205
"Genady Beryozkin" <Ge*************@discussions.microsoft.com> wrote in
message news:AF**********************************@microsof t.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
Here are some hints:
1) You should define _Module in a file compiled without /clr.
2) You should make sure that no managed code is executed during the
construction of _Module
3) You should not use #pragma unmanaged
4) You should not compile all your project files with /clr
Hope this helps
I respectfully disagree with Marcus. It looks like you have some old VC6
code. I would upgrade the code to VC8 first before applying the steps as
outlined in the KB article.
Brian
"Brian Muth" <bm***@mvps.org> wrote in message
news:ep**************@TK2MSFTNGP02.phx.gbl... I respectfully disagree with Marcus. It looks like you have some old VC6 code. I would upgrade the code to VC8 first before applying the steps as outlined in the KB article.
Brian
Hi Brian,
maybe I am too jetlagged currently, but VC6 does not support /clr, so the
code must at least have been ported from VC6 to a higher VS version already.
Given that the question refers to an article of the VC8 documentation, I
assume it has been ported to VC8 already. However, I agree with you that if
the project is ported to VC7 or VC7.1, it should first be ported to VC8.
Respectfully, Marcus
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" <Ge*************@discussions.microsoft.com> wrote in
message news:AF**********************************@microsof t.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
The OP talks about using _Module, which is part of ATL3 in VS6. VC8 uses
_AtlModule.
Brian.
Hi Brian,
"Brian Muth" <bm***@mvps.org> wrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl... The OP talks about using _Module, which is part of ATL3 in VS6. VC8 uses _AtlModule.
Brian.
But VC8 still supports _Module and CComModule, so if the project is ported
from VC6 to VC8, it will likely use the old alternatives...
The only one who can tell us what the concrete situation is, is the original
poster, but it seems he doesn't care about us any more :-)
Marcus
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" <Ge*************@discussions.microsoft.com> wrote in message news:AF**********************************@microsof t.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
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" <Ge*************@discussions.microsoft.com> wrote in
message news:E4**********************************@microsof t.com... 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" <Ge*************@discussions.microsoft.com> wrote in message news:AF**********************************@microsof t.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 >
I'm afraid I can't reproduce it right now, since I also don't have VC6
installed.
Can you point me to instructions of upgrading ATL/MFC code to VC8? (is it
somewhere in MSDN?)
Following the instructions that I found on MSDN, I only compile stdafx.cpp
without /clr and the rest of the files are compiled with /clr. Of course
I escape the dll initialization functions with an #pragma unmanaged section.
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. 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.
Thanks again,
Genady
"Marcus Heege" wrote: 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" <Ge*************@discussions.microsoft.com> wrote in message news:E4**********************************@microsof t.com... 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" <Ge*************@discussions.microsoft.com> wrote in message news:AF**********************************@microsof t.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 >
"Genady Beryozkin" <Ge*************@discussions.microsoft.com> wrote in
message news:68**********************************@microsof t.com... I escape the dll initialization functions with an #pragma unmanaged section.
Don't use #pragma unmanaged - functions that should be compiled to native
code should end up in files compiled without /clr
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.
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.
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.
Please send me the callstack you see when the assertion occurs. I would like
to use it for research purposes.
Thanks again, Genady
"Marcus Heege" wrote:
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" <Ge*************@discussions.microsoft.com> wrote in message news:E4**********************************@microsof t.com... > 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" <Ge*************@discussions.microsoft.com> wrote >> in >> message news:AF**********************************@microsof t.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
>> I escape the dll initialization functions with an #pragma unmanaged section.
Don't use #pragma unmanaged - functions that should be compiled to native code should end up in files compiled without /clr
Hi Marcus,
You seem to be very adamant about not using #pragma unmanaged.
is there a specific reason, or side effects that are not obvious?
The only thing I can see against it would be readability and practical
problems with project maintenance.
kind regards,
Bruno.
"Bruno van Dooren" <br**********************@hotmail.comwrote in message
news:OM**************@TK2MSFTNGP05.phx.gbl...
>>I escape the dll initialization functions with an #pragma unmanaged section.
Don't use #pragma unmanaged - functions that should be compiled to native code should end up in files compiled without /clr
Hi Marcus,
You seem to be very adamant about not using #pragma unmanaged.
is there a specific reason, or side effects that are not obvious?
The only thing I can see against it would be readability and practical
problems with project maintenance.
kind regards,
Bruno.
http://www.heege.net/blog/default.as...9-9da8ec9e091e This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Jeff Epler |
last post by:
Hello.
Recently, Generator Comprehensions were mentioned again on python-list.
I have written an implementation for the compiler module. To try it
out, however, you must be able to rebuild...
|
by: livin |
last post by:
my log...
INFO urllib.urlopen('http://192.168.1.11/hact/kitchen.asp',
urllib.urlencode({'Action': 'hs.ExecX10ByName+Kitchen+Lights%2C+On
%2C+100&x=4&y=6'}))
INFO
INFO File...
|
by: Fuzzyman |
last post by:
Hello all,
The following is a copy of a blog entry. It's asking a question about
future statements and the built in compile function. I'd appreciate any
pointers or comments about possible...
|
by: Aras Kucinskas |
last post by:
Hello,
I have developed a web application using VS 2005. The application contains
couple of independent modules. The forms and controls code files are
separated in to .vb and .ascx. Now I want...
|
by: Steve |
last post by:
Hi All,
I'm having a tough time converting the following regex.compile patterns
into the new re.compile format. There is also a differences in the
regsub.sub() vs. re.sub()
Could anyone lend...
|
by: Jérôme Le Bougeant |
last post by:
Hello (and sorry for my English),
I downloaded the VideoCapture module on the
http://videocapture.sourceforge.net/ site. I tested it with a webcam and
that functions.
Now I want to...
|
by: yichao.zhang |
last post by:
I'm trying to match the characters from u'\uff00' to u'\uff0f'.
the code below and get a TypeError.
p = re.compile(u'\uff00'-u'\uff0f')
Traceback (most recent call last):
File "<interactive...
|
by: Mitko Haralanov |
last post by:
For various reason, what I need to do is be able to send some Python
code (mostly entire functions in the form of a string) to a remote
server (written in Python), have that server compile the code...
|
by: RP |
last post by:
I have a module written using VB 2005 which contains many ready to use
functions. For some specific reasons, I cannot make it a DLL. Can I
integrate this module in my C# project? If yes, how.
|
by: pereges |
last post by:
Do you see anything wrong about this method ? For eg. I write a shell
script a.sh containing :
cc -o test file1.c file2.c file3.c
and then execute the shell script ( sh a.sh) to compile and...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |