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

Home Posts Topics Members FAQ

Exporting functions in C#

I need implementing Windows Cluster Resource DLL, that requires me creating
DLL exporting several functions. How it can be done in C#?

Thanks,
Alexander
Nov 15 '05 #1
4 2032
You can create a DLL that implements an interface such as
IWEExtendContex tMenu or IWEExtendProper tySheet and access it as a COM object
but you cannot use a C# DLL as you would a C++ DLL.

Implement your interfaces and register the DLL for COM interop in the
project build properties.

--
Bob Powell [MVP]
C#, System.Drawing

The November edition of Well Formed is now available.
Learn how to create Shell Extensions in managed code.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Read my Blog at http://bobpowelldotnet.blogspot.com

"Alexander Filatov" <none> wrote in message
news:Of******** ******@TK2MSFTN GP12.phx.gbl...
I need implementing Windows Cluster Resource DLL, that requires me creating DLL exporting several functions. How it can be done in C#?

Thanks,
Alexander

Nov 15 '05 #2

Hi Alexander,

Based on my understanding, you want to create a managed dll which exports
function to unmanaged code.
I think you can create a managed dll and create a COM wrapper for it. The
article below tells you how to do COM wrapper:
http://msdn.microsoft.com/library/de...us/cpguide/htm
l/cpconcustomizin gcomcallablewra ppers.asp

The article below shows how to: "Export Managed Code as Unmanaged"
http://www.c-sharpcorner.com/Code/20...sUnmanaged.asp

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 15 '05 #3
Hi, Jeffrey!

As far as I know, COM dlls exports several predefined functions such as
DllRegisterServ er, DllCanUnload etc. How can I export function with other
name (clustering API requires me exporting Start function)? Or... may be I
miss your thought?

The second link solves exact problem, but it is too awkward developing
application is such a way :(. Do you know, is this problem will be addressed
in next C# version?

Thanks a lot,
Alexander.
""Jeffrey Tan[MSFT]"" <v-*****@online.mi crosoft.com> wrote in message
news:HI******** ******@cpmsftng xa07.phx.gbl...

Hi Alexander,

Based on my understanding, you want to create a managed dll which exports
function to unmanaged code.
I think you can create a managed dll and create a COM wrapper for it. The
article below tells you how to do COM wrapper:
http://msdn.microsoft.com/library/de...us/cpguide/htm l/cpconcustomizin gcomcallablewra ppers.asp

The article below shows how to: "Export Managed Code as Unmanaged"
http://www.c-sharpcorner.com/Code/20...sUnmanaged.asp
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 15 '05 #4
You can't build Cluster resource dll's using C#, native C++ is your only
option. You should even consider (yet) using any of the managed languages
for this kind of system level programming, the CLR overhead is too large for
things like device drivers, cluster resources ...., unless you don't mind a
workingset foot-print of ~8MB.

Willy.

"Alexander Filatov" <none> wrote in message
news:uR******** ******@TK2MSFTN GP09.phx.gbl...
Hi, Jeffrey!

As far as I know, COM dlls exports several predefined functions such as
DllRegisterServ er, DllCanUnload etc. How can I export function with other
name (clustering API requires me exporting Start function)? Or... may be I
miss your thought?

The second link solves exact problem, but it is too awkward developing
application is such a way :(. Do you know, is this problem will be addressed in next C# version?

Thanks a lot,
Alexander.
""Jeffrey Tan[MSFT]"" <v-*****@online.mi crosoft.com> wrote in message
news:HI******** ******@cpmsftng xa07.phx.gbl...

Hi Alexander,

Based on my understanding, you want to create a managed dll which exports function to unmanaged code.
I think you can create a managed dll and create a COM wrapper for it. The article below tells you how to do COM wrapper:

http://msdn.microsoft.com/library/de...us/cpguide/htm
l/cpconcustomizin gcomcallablewra ppers.asp

The article below shows how to: "Export Managed Code as Unmanaged"

http://www.c-sharpcorner.com/Code/20...sUnmanaged.asp

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.


Nov 15 '05 #5

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

Similar topics

3
3970
by: chetan | last post by:
Hi , myself Chetan Is There anybody could help me ? I am working on the project in c++ ,, I am in great confusion that should I export c++ member functions OR methods to create objects of that class OR previously cretaed objects .. So those can be used by users by using the header file ... of my " class "
2
7715
by: G | last post by:
When I export data from access to excel by with "export" or "Analyze with" I seem to loose parts of some fields (long text strings). Is there a way to export it all to excel? Thanks G
1
1072
by: JackHWarner | last post by:
I'm porting an app from vc++6 to vc++ 7.1, and am having some trouble exporting functions. I can export simple functions from a DLL by simply putting __declspec(dllexport) in front of them, and I can then use them just fine in my app. When I try to export a function with a CString argument, though, I can't seem to get anything to work. I can get the DLL to link, but I always get a link error on my app. I've tried the __declspec(dllexport),...
7
1897
by: victorsk | last post by:
Hello, I have a dll which I compiled in VB. Now I would like to use this dll in MapBasic program. However, I keep getting an error saying that the function which I am calling cannong be found. After doing some research, I learned that VB's functions are not exportable and suggestion is to get PowerBasic or XBasic. I am just starting with VB so I am not sure if I am right, but can somebody please tell me if I can make exportable...
0
302
by: victorsk | last post by:
Hello, I need to write a DLL app in VB whose functions would be called by another app. VB's DLL's don't support exporting functions. However, I found a site that provides a way to export VB functions. But, I have been having trouble making that compiler-linker to work. I am new to VB but what I understand is this app mimics a generic "link.exe" while applying a generic renamed "link.exe" called "link1.exe" by issuing commands to modify a...
2
1343
by: Pedro Fernandes | last post by:
Hi. I need held in exporting some c++ functions to c#. Does anyone has a simple sample? Thanks in advance.
6
8239
by: sara | last post by:
I have what I think is a little strange...I have to get data from our payroll system into a specific format (fixed record length) as a .txt or .prn file only to upload to our 401k custodian. I can get the data into Access (from Payroll) and write a query with all the fields (inserting fields with spaces, as needed), but I can't figure out how to get it to export to a .txt file - without the field name header row. I don't really ...
12
7261
by: 2b|!2b==? | last post by:
I want to export my C++ classes in a DLL, using ordinal # - rather than by name. Will anyone care to enumerate through the steps required to do this? I am already failiar with exporting classes and symbols (both C++ and C) from a DLL. In the case of C functions, i also know how to export them by ordinal # - my main problem revolves around how to do the ff: 1). Obtaining the mangled names from the C++ DLL 2). How to map them (if any...
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
10604
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
10356
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
7644
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6874
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
5676
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3839
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3006
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.