473,657 Members | 2,524 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Exported C++ class

Hi,

I have a DLL that has a C++ class exported. Is there any way that I can
use this class in a C# program? I know about the COM interop but this class
isn't a COM class. I also know about accessing functions in DLLs using the
DllImport attribute but I don't think that imports classes (or does it??).
Any help will be appreciated. Thanks!

Gene
Aug 10 '05 #1
2 1198
Gene,
I have a DLL that has a C++ class exported. Is there any way that I can
use this class in a C# program?


Not directly no. The easiest way to do it would be to write a COM or
managed wrapper in C++.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Aug 11 '05 #2
Thanks!

"Mattias Sjögren" <ma************ ********@mvps.o rg> wrote in message
news:%2******** ********@TK2MSF TNGP14.phx.gbl. ..
Gene,
I have a DLL that has a C++ class exported. Is there any way that I
can
use this class in a C# program?


Not directly no. The easiest way to do it would be to write a COM or
managed wrapper in C++.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Aug 11 '05 #3

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

Similar topics

6
1810
by: Mayer | last post by:
Hello: Is there a way to see at the python prompt the names of all the public methods of a class or the names exported by a module? I know that GUI-based IDEs have a nifty way of displaying these in the form of a drop-down list, but I'm looking for some function or method that will simply return a list of strings. Thanks,
1
1423
by: Ingo Nolden | last post by:
Hi there, following example: class __declspec( dllexport ) Example { public: // ... some public funcs
1
1896
by: vijay | last post by:
I'm having trouble with calling an exported function in a native DLL compiled with eMbedded Visual C++ using C#. Basicly, I have one exported function in the DLL: whenever i execute this exe to Pocket pc it returns MissingMethod Exception. Code for DLL is NativeFunctions.h
2
4188
by: Rookie | last post by:
Hi, I have a DLL written in VC++ which exports a class. I want to import this class into a C# application and be able to instantiate it in the C# code. Is it possible to do this? If yes, is it using StructLayout? If yes, even after defining the class in my C# app. using StructLayout how do I actually link my code to the DLL? Are there any other settings to be changed?
4
1771
by: mccoyn | last post by:
I have a class exported in a dll that has member variables I wish to access. When I do it I get an error C2039: 'myVar' : is not a member of myClass Here is an example of what my code looks like In the library __gc class MyClass public int myVar
2
274
by: Gene Daniel | last post by:
Hi, I have a DLL that has a C++ class exported. Is there any way that I can use this class in a C# program? I know about the COM interop but this class isn't a COM class. I also know about accessing functions in DLLs using the DllImport attribute but I don't think that imports classes (or does it??). Any help will be appreciated. Thanks! Gene
1
1239
by: amitdedhia | last post by:
Hi I am migrating a product code (originally written in VS2003) to VS2005. The application is written in VC++ (using MFC) and has mix of managed and unmanaged classes. It is a desktop based application which controls an instrument (a device) and interacts with it. I fixed all the compiler errors and ran the application. I got a message that "The procedure entry point XXX could not be located in the dynamic link library AAAA.dll.
18
1796
by: ciccio | last post by:
Hi all, The intel c++ compiler supports exported templates but I was wondering a bit about their used syntax. If I compare the syntax written in strostroup's book then there is a difference. So I was wondering if the following syntax proposed by intel is correct. Thanks a lot
4
2683
by: =?Utf-8?B?SmVzc2ljYQ==?= | last post by:
Hi All, I know that I can use the GetProcAddress to get the proc address of a global exported function from a WIn32 dll. But if I have an exported class in the dll, is there a way to dynamically load this dll and get an instance of this class? (No static linking with the lib file) I am currently thinking about having global exported functions which internally calls the member functions of the class's single instance. These global...
0
8413
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
8842
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
8740
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
8513
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
8617
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7352
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...
1
2742
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
2
1970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1733
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.