473,805 Members | 2,017 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

exporting unmanaged classes from a managed dll

is it possible to export (and, above all, import afterwards) an unmanaged class from a managed dll (compiled with the /clr switch. it would in fact probably result in a mixed mode dll)? it seems that member methods of any exported unmanaged class are compiled as static and global if the /clr switch is on. why? how to import such classes in antoher project? is there a workaround?

thanks...

---
Posted using Wimdows.net NntpNews Component -

Post Made from http://www.DotNetJunkies.com/newsgroups Our newsgroup engine supports Post Alerts, Ratings, and Searching.
Nov 17 '05 #1
3 1767
__declspec(dlle xport) and __declspec(dlli mport) or whatever other mechanism
you are already using in the situation where you are not compiling with
/clr.

Ronald Laeremans
Visual C+++ team

"nikola" <pejcicn@-NOSPAM-club-internet.fr> wrote in message
news:eZ******** ******@tk2msftn gp13.phx.gbl...
is it possible to export (and, above all, import afterwards) an unmanaged
class from a managed dll (compiled with the /clr switch. it would in fact
probably result in a mixed mode dll)? it seems that member methods of any
exported unmanaged class are compiled as static and global if the /clr
switch is on. why? how to import such classes in antoher project? is there
a workaround?

thanks...

---
Posted using Wimdows.net NntpNews Component -

Post Made from http://www.DotNetJunkies.com/newsgroups Our newsgroup
engine supports Post Alerts, Ratings, and Searching.

Nov 17 '05 #2

Thanks Ronald.
Still, it does not respond completely to my questions: "how?" & "i
there a workaround?".
There might be one: the exported unmanaged class should inheri
from an unmanaged pure virtual class (technically an interface), b
created by a managed class from the same (managed, compiled with /clr
library, and presented to the outside world as the mentioned unmanage
interface. It is maybe a little bit "heavy", but I haven't found an
other way.

Thanks again.
Regards,
n
-
nikol
-----------------------------------------------------------------------
Posted via http://www.codecomments.co
-----------------------------------------------------------------------

Nov 17 '05 #3
I think I am still misunderstandin g what you are trying to do. To export a
class (i.e. the definition of a class since that is the only thing you can
"export") is completely independent from whether you compile the DLL with
the /clr switch for all compilands, for no compilands or for a subset of all
compilands.

What you are referring to now seems to have something to do with an instance
of this class.

If you can provide a few lines of sample code, plus an illustration of what
broke in your scenario by virtue of specifying the /clr switch should make
sure I understand fully what you are trying to do.

Thanks!

Ronald

"nikola" <ni***********@ mail.codecommen ts.com> wrote in message
news:ni******** ***@mail.codeco mments.com...

Thanks Ronald.
Still, it does not respond completely to my questions: "how?" & "is
there a workaround?".
There might be one: the exported unmanaged class should inherit
from an unmanaged pure virtual class (technically an interface), be
created by a managed class from the same (managed, compiled with /clr)
library, and presented to the outside world as the mentioned unmanaged
interface. It is maybe a little bit "heavy", but I haven't found any
other way.

Thanks again.
Regards,
n.

--
nikola
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------

Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
741
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 managed point-of-view I've noticed that: 1) for each managed and unmanaged C function (not C++ classes) I get a public managed static method (defined on a 'Global Functions' class) in the generated assembly with an export name of the form...
6
10261
by: Stijn | last post by:
Hi there, I have the following problem. At the moment I am creating an application that interfaces with several hardware modules via USB. Each of these devices has its own functionality and I want to make this functionality available to programmers in a very generic way. Therefore I came up with the following idea. 1) USB devices can have a small description. In this description i will store the name of the DLL that covers the device...
0
1490
by: Niall | last post by:
I'm attempting to put a C# front end on my unmanaged C++ ray tracer code. It's still in experimental stage, as I have never done anything with exporting types from an unmanaged dll through to a managed C# dll before. Currently, I have an unmanaged dll, a managed C++ wrapper dll and a C# dll. I have managed to get enough exported from the unmanaged code to get a vaguely correct picture on the screen, however there is some odd behaviour. ...
2
9508
by: joye | last post by:
Hello, My question is how to use C# to call the existing libraries containing unmanaged C++ classes directly, but not use C# or managed C++ wrappers unmanaged C++ classes? Does anyone know how to do that? Thanks. Tsung-Yu
2
2061
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 afterwards with ILDASM at what is visible in those assemblies from a managed point-of-view I've noticed that: 1) for each managed and unmanaged C function (not C++ classes) I get a public managed static method (defined on a 'Global Functions' class) in the generated assembly with an export name of the form
7
2625
by: Gustavo L. Fabro | last post by:
Greetings! Some classes that once compiled without problems on VS 2003 have now problems on VS 2005 Beta 1. I'm talking about a __nogc class that is exported with __declspec(dllexport). The compiler message is this: VCSelectLibraryForm.cpp ...\Forms\QiForm.h(48) : error C3395: 'TQiForm::GetDotNetMouseButton' :
9
3123
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 this, I want to use it. Is it possible to call Managed class functions from Unmanaged class? How to do it? I did something like this. I declared a managed class (in C++ CLI) called as MyManagedClass whose
2
12363
by: Jon Slaughter | last post by:
How difficult is it for one to integrate unmanaged C++ into C#? I know for functions one can use DLLimport but how does one go about doing it for classes? Do I have to completely reimplement the classes in managed C++ as a wrapper to the unmanaged C++ classes or is there an easier way? Essentially what I have done is written a C++ kernel mode driver and I want to use it from my C# program. Because it requires some setup outside the...
1
570
by: Saad | last post by:
Hi, I have a MC++dll, whose functions i want to use in unmanaged c++. I read that one of the ways to use the managed functions in unmanaged world is by exposing the managed api as flat api. I tried that and with simple data types it worked. But now i need to export a function which needs to take a gc struct as parameter, and then fill some values in it, and then the unmanaged c++ will use that info.
0
9716
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9596
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10607
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10359
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10364
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9182
agi2029
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6875
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5541
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4317
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.