473,386 Members | 1,741 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

managed type or function cannot be used in unmanaged function

45
Hi all,
I have someting like this...

xyz.h

Expand|Select|Wrap|Line Numbers
  1. #using   <mscorlib.dll>
  2. #include <vcclr.h>
  3.  
  4. using namespace std;
  5.  
  6. using namespace System;
  7. using namespace System::Data;
  8. using namespace System::Data::OleDb;
  9. using namespace System::Data::SqlClient;
  10. using namespace System::Runtime::InteropServices;
  11.  
  12. #pragma unmanaged
  13.  
  14. class xyz
  15. {
  16.   public:
  17.       string str1;
  18.       gcroot<SqlConnection^> sqlConn;
  19.       void someFun();
  20. };
xyz.cpp

Expand|Select|Wrap|Line Numbers
  1. #include "xyz.h"
  2.  
  3. void xyz::someFun()
  4. {
  5.    sqlConn = new SqlConnection();
  6. }
  7.  
Which gives me the error C3821: Managed type or functions cannot be used in unmanaged functions what is the work around for this.

Thanks.
Mar 11 '08 #1
0 1205

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: | last post by:
I am trying to use my unmanaged c++ class library in managed classes. So far everything seems to be ok, just passing on the __events from unmanaged to managed code using the __hook functions is a...
2
by: Martin Zenkel | last post by:
Dear VS Team, using the Beta 2 of VS 2005 I've encontered the following problem. Let's assume threre are three Dll's, one unmanaged and two managed. In the unmanaged we put a simple unmanged...
13
by: bonk | last post by:
Hello, I am trying to create a dll that internally uses managed types but exposes a plain unmanaged interface. All the managed stuff shall be "wrapped out of sight". So that I would be able to...
4
by: RedJoy | last post by:
I am switching from VS2003 .NET to VS2005 and I receive the following errorwhen compiling my project: error C3821: 'File': managed type or function cannot be used in an unmanaged function...
4
by: devmentee | last post by:
I want to write a managed wrapper( kind of proxy) which will call into unmanaged C++ code. I've got a general idea and have read some articles on how to do it. But I cannot find any information on...
7
by: harishashim | last post by:
I am wrapping a digital camera API using Managed C++ VS .NET 2003). I have this function that called as bellow in the API sample. err = PR_RC_StartViewFinder( m_hCamera, //line 1...
6
by: Aston Martin | last post by:
Hi All, ********************** My Situation ********************** I am working on project that involves passing a structure to unmanaged code from .Net world (well using C#). Perhaps an example...
3
by: vijay.gandhi | last post by:
Hi, I am trying to convert some unmanaged code (C++) to managed code (using C++/CLI). 1) One of the functions used returns a void* which I need to cast into a handle of a managed object. Can...
0
by: MarukoS | last post by:
I am converting a MFC solution from VS2003 to VS2005. And I got the following error: error C3821: 'System::Xml::XmlDocument *': managed type or function cannot be used in an unmanaged function I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
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,...
0
jinu1996
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.