.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Easy Web
Imran Ghani
Post New Web Links

Wrap unmanaged dll and interfaces

Posted By:      Posted Date: September 23, 2010    Points: 0   Category :.NET Framework
 

Hi.

I wan't to use unmanaged dll (C++, not COM). My problem is that dll doesn't have static functions but expose (throw header file) some interfaces to class. For example IClientFactory.h looks like that:

class IClientFactory : public IUnknown
{
public:
	virtual BOOL Init() = 0;
	virtual BOOL CreateClient( IClient **pClient ) = 0;
	virtual void Exit() = 0;
};

class __declspec( uuid("{B4041BE8-B1E6-485f-AD3D-BF79FDDFFD3B}") ) IClientFactory;

Usage in C++ is as follows:

m_hClientDll = ::LoadLibrary( L"sdk.dll" );
	if ( m_hClientDll )
	{
		// get entry function
		GET_CLIENT_FACTORY *GetClientFactory = (GET_CLIENT_FACTORY *)::GetProcAddress( m_hClientDll, "GetClientFactory" );
		 

View Complete Post


More Related Resource Links

InterFaces and Abstract Classes

  
Link Describes About Abstraction and Interfaces In Breif

Use Unmanaged C++ class in .NET

  

Hi Everyone,


I have one project which is developed in unmanaged C++ code.


Now i want to use all unmanaged classes of C++ in .NET


I have one method called .NET wrapper in which i have to convert Unmanaged C++ class to managed C++ class which will then use as proxy class.

details for that are given in below link.

http://msdn.microsoft.com/en-us/library/aa712980(VS.71).aspx


Is there any other solution for develop this?


Toolbox: User Interfaces, Podcasts, Object-Relational Mappings and More

  

This column covers common user interface groupings, configuring NHibernate using C#, and a look at interesting books and podcasts.

Scott Mitchell

MSDN Magazine October 2009


Cutting Edge: Build Rich User Interfaces with jQuery

  

In this month's installment we build modal and modeless dialog boxes in jQuery and explain how to post data from them to the Web server.

Dino Esposito

MSDN Magazine May 2009


CLR Inside Out: Marshaling between Managed and Unmanaged Code

  

Marshaling is an important part of .NET interop. It allows you to call into unmanaged code from managed code. This column will help you get started.

Yi Zhang and Xiaoying Guo

MSDN Magazine January 2008


Netting C++: The .NET Wrap

  

This month, we are changing the column name from Pure C++ to Netting C++ to better reflect our focus on Microsoft® . NET programming using C++/CLI, the . NET extensions to Visual C++® that are supported in Visual Studio® 2005.

Stanley B. Lippman

MSDN Magazine June 2006


{ End Bracket }: Building Voice User Interfaces

  

The GUI is the interface of choice for scenarios when the user has a large keyboard, mouse, and display. But most cell phones have just a keypad and a small display. Drivers want to get directions without taking their eyes off the road or their hands off the wheel.

Alex Acero

MSDN Magazine February 2006


.NET Internals: Examine Running Processes Using Both Managed and Unmanaged Code

  

There are plenty of times when you need to get information on running processes, not the least of which is during performance tuning. Using the techniques in this article and special .NET classes you'll see how to get a process' ID, name, priority, number of threads, kernel handle, and memory consumption, as well as its user-mode, kernel-mode, and total elapsed running time and put them to use in a custom app called AssemblyBrowser.

Christophe Nasarre

MSDN Magazine October 2004


Coroutines: Implementing Coroutines for .NET by Wrapping the Unmanaged Fiber API

  

Coroutines are a powerful feature of many programming languages including CLU, Scheme, Python, Ruby, and ICON. Coroutines can save processor overhead and reduce redundancy because they allow you to stop execution of a procedure midstream, return a value, and resume exactly where the procedure left off.This article shows how coroutines can be implemented for the .NET Framework by using the Fiber API and Managed Extensions for C++, and how they can be easily used with other .NET-compliant languages. This article also shows a sophisticated use of the runtime host for running multiple managed threads on a single OS thread.

Ajai Shankar

MSDN Magazine September 2003


C++ and ATL: Use ATL Server Classes to Expose Your Unmanaged C++ Code as an XML Web Service

  

Throughout this issue, you'll read all about the promise of Web Services and how the .NET Framework enables Web Service development. Many people will also be building their Web Services atop C++ code and frameworks like ATL Server, particularly when performance is paramount. In this article, the authors show how fully functional Web Services are built using ATL Server and Visual Studio .NET. Beginning with unmanaged C++ classes, they add ATL attributes that make the code work over HTTP.

Kirk Fertitta and Chris Sells

MSDN Magazine December 2002


Scripting SQL: VBScript Interfaces in SQL Server 2000 Let You Transform Data and Provide Reports to

  

Application service providers often must send information to clients automatically rather than on-demand. For example, a manufacturer may want to know each day how many of their products were sold by a retail chain. While SQL Server is ideal for maintaining this type of database, you have to write scripts to get the data out in a client-friendly format. Here you will see how you can use Data Transformation Services (DTS), a powerful tool in SQL Server, to automate the retrieval and formatting of data from SQL Server 2000 and make the process of pushing data to your users a lot easier.

Alok Mehta and Daniel Williams

MSDN Magazine August 2002


SOAP: Using ATL Server to Build an Asynchronous SOAP Client in Unmanaged C++

  

SOAP opens up a new world of Web Services, letting you make function calls across a network or the Internet. But this flexibility creates new problems when your app needs to wait for calls to return from halfway around the world. What you need is an asynchronous SOAP client that takes advantage of threading to continue execution while waiting for calls over the wire. This article covers the basics of building such a client with ATL.

Pranish Kumar and Bogdan Crivat

MSDN Magazine April 2002


RPC and C++: Build a Template Library for Distributed Objects Containing Multiple Interfaces

  

Building a C++ template library for developing distributed object-oriented applications using Remote Procedure Calls (RPC) allows the programmer to design RPC applications that are composed of components that implement multiple interfaces. This article demonstrates the use of techniques such as assembly-level thunks to build machine code on the fly, and C++ features such as templates, conversion operators, virtual destructors and virtual function tables. Along the way, familiar C++ interfaces and classes are transformed into a distributed application. The benefits of using distributed objects rather than raw remote procedures, which include writing fewer lines of code, is explained.

Ajai Shankar

MSDN Magazine November 2000


Developer Training: User Interfaces and Lists in SharePoint 2010

  
Learn about the new user experience in SharePoint 2010 and how you can use the new UI in your customizations. This training module also discusses improvements in list handling, including list relationships and new form-rending options.
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend