Ok Tian, if I understand you, you are saying that I can build some
managed code into my unmanaged DLL project and then access it from a
managed web server??? How does that work?
Meanwhile I found some information that helps and finally got my test
web service to compile. But there are problems.
First let me tell you what I have done.
Following the instructions in the article "Converting Managed
Extensions for C++ Projects from Pure Intermediate Language to Mixed
Mode", I changed my project settings as follows:
1. Link with /NOENTRY (was already set that way)
2. Removed nochkclr.obj as a linker input
3. Added msvcrt.lib as a linker input
4. Added __DllMainCRTStartup@12 to the Force Symbol References.
Also in stdafx.h, added includes for afx.h, afxwin.h, afxext.h,
afxdtctl.h, and afxcmn.h.
These changes allow me to compile and link and use such constructs as
CObject and CPtrList if they are created and used in the same test
project. But a strange thing happens. Every time I build the project
it indicates zero warnings and zero errors, but when I try to run the
project it tells me that the project is out of date and needs to be
rebuilt. If I build it again, it links only, but still tells me it is
out of date when I run it from VC++ (Ctrl + F5). In fact I can build
the project over and over and it relinks every time. This does not
happen when I change the project settings back to the original.
I cleaned/rebuilt, and then checked the date/time stamp of every item
in the debug folder and they were all the same (current time). I
waited until the next minute and hit "build solution" and the project
relinked.
However when I ignore the out of date warning and execute the program,
it works and all changes made in the last build are implemented
properly, so I have proceeded to try other things.
Once I had accomplished the above, I started to add code to use my MFC
Extention DLL. I had to make another change to the project settings,
changing the Configuration properties to "Use MFC in a Shared DLL".
This now works!!! I can create instances of classes in my library and
access them from within the web service, and display the results via
web methods.
I have now run smack into some security issues that I have not been
able to figure out, but I will start a new thread if/when I need help
with that.
But I would like some input from you about the "project out of date"
issue. That is very inconvenient and will cause problems when I get
ready to add projects like this to source control.
Thank you very much for your help. In the future if anyone else asks
about this issue, you could save some time by referring them to the
article "Converting Managed Extensions for C++ Projects from Pure
Intermediate Language to Mixed Mode".
Thanks again, Russ
On Fri, 14 May 2004 11:29:11 GMT, timhuang@online.microsoft.com (Tian
[quoted text, click to view] Min Huang) wrote:
>Hello Russ,
>
>Thanks for your response. I now share the following information with you:
>
>1. I created a C++ managed project which includes atlstr.h, and then it
>works properly with CString variables (both compile and execute).
>
>2. When we use unmanaged code in C++ .NET application, we should include
>corresponding header and library files. As in this case, I suggest that you
>can keep your unmanaged C++ project and perform the following two steps in
>order to add managed code to it:
>
>step 1: Add the following code:
> #using <mscorlib.dll>
>
>If you are using VS .NET 2003, you can simple add reference to mscorlib.dll
>in your project.
>
>step 2: compile with /clr:
>
>a. Open the project's Property Pages dialog box.
>b. Click the Configuration Properties folder.
>c. Click the General property page.
>d. Modify the Use Managed Extensions property.
>
>3. If the problem persists, could you post a simple project which is able
>to reproduce the problem?
>
>Hope this helps.
>
>Regards,
>
>HuangTM
>Microsoft Online Partner Support
>MCSE/MCSD
>
>Get Secure! --
www.microsoft.com/security >This posting is provided "as is" with no warranties and confers no rights.