473,385 Members | 1,492 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,385 software developers and data experts.

Managed DLL in unmanaged c++?

Plater
7,872 Expert 4TB
The biggest problem is that my higher-up is a stubborn guy and won't use anything other then MFC.
I have a DLL that I wrote in C# that performs some socket operations.

Is there anyway to use this DLL in unmanaged code? (The system it will be running on supports managed code and runs .Net2.0)

He needs this functionality, but he would rather talk on a socket to another program running and tell that one to perform the socket options.
That's a lot of extra overhead if I can get away with letting him use my dll.

Is it possible to go managed->unmanaged?
Sep 6 '07 #1
5 2230
Banfa
9,065 Expert Mod 8TB
Is it possible to go managed->unmanaged?
In C++ in theory yes.

Unfortunately that just about reaches the limit of my knowledge of .NET

However try these links

http://blogs.msdn.com/deeptanshuv/ar...26/432870.aspx

http://www.thescripts.com/forum/thread395675.html
Sep 6 '07 #2
weaknessforcats
9,208 Expert Mod 8TB
Is it possible to go managed->unmanaged?
Yep.

Just code:
Expand|Select|Wrap|Line Numbers
  1. #pragma manaaged
  2.  
  3. //managed code goes here
  4.  
  5. #pragma unmanaged
  6.  
  7. //unmanaged code goes here
  8.  
  9. #pragma managed
  10.  
  11. //back to managed code again
  12.  
Sep 7 '07 #3
Plater
7,872 Expert 4TB
It's gotta be a "compiled" thing he can use because embeded doesn't do managed code in it's compiler
Sep 7 '07 #4
weaknessforcats
9,208 Expert Mod 8TB
MFC aside, your managed code requires a CLR. I assume that's OK.

Therfore, have your MFC relic call a DLL function that's not managed. That function calls the managed code. That restricts all of the managed vs unmanaged to the dll and therefore to the building of the dll.
Sep 8 '07 #5
Plater
7,872 Expert 4TB
MFC aside, your managed code requires a CLR. I assume that's OK.

Therfore, have your MFC relic call a DLL function that's not managed. That function calls the managed code. That restricts all of the managed vs unmanaged to the dll and therefore to the building of the dll.
That is an interesting idea that I will look in to.
Sep 10 '07 #6

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

Similar topics

1
by: Bob Rock | last post by:
Hello, in the last few days I've made my first few attempts at creating mixed C++ managed-unmanaged assemblies and looking aftwerwards with ILDASM at what is visible in those assemblies from a...
1
by: Eric Twietmeyer | last post by:
Hello, I'm starting to investigate cs, managed c++ and interoperating with a very large unmanaged code base. We are going to use Windows Forms (written in cs) to replace our old fashioned GUI. ...
5
by: Chris Kiechel | last post by:
I am writing a .NET Windows application and it needs to perform DDE calls to a legacy system. I created a C++ unmanaged class that performs the actual DDE connection and communication. However,...
3
by: zhphust | last post by:
I want to convert a object of a managed class to a unmanaged structure that has the same member with that managed class. Can anybody tell me how i can do it? Thanks in advance. -- zhphust...
3
by: Thorsten | last post by:
HI I'm a C# developer and unfortunately I have to write now some code in managed and unmanaged C++. In this area I'm Newbie and therefore please forgive me if this is a really simple...
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...
12
by: doug | last post by:
I understand the basics of what managed code offers and that you open yourself up to security issues if you allow unmanaged code. We already have a decent amount of VB6 code to include COM DLLs. ...
6
by: nicolas.hilaire | last post by:
Hi all, i'm not totally clear with some concepts about managed and unmanaged code. I'm asking myself some questions : - i've a MFC app, i want to use the framework dotnet by switching to...
9
by: Amit Dedhia | last post by:
Hi All I have a VC++ 2005 MFC application with all classes defined as unmanaged classes. I want to write my application data in xml format. Since ADO.NET has buit in functions available for...
25
by: Koliber (js) | last post by:
sorry for my not perfect english i am really f&*ckin angry in this common pattern about dispose: ////////////////////////////////////////////////////////// Public class...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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 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.