473,503 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DllImport question

Hi,

I was trying to link a UI I made in C# to the backend which is coded
as a DLL in VC++.

I used the DllImport attribute to invoke the dll functions. Is there
any similar mechanisms by which I can invoke member functions of
classes defined in the dll?

Is there any way I could instantiate an object of a class defined in
the dll?

I am new to C#/dll's et al so I am not too sure if these questions
make sense. But if anyone can provide some info on this and more
importantly provide pointers to articles/examples on these topics it
would be a tremendous help.

Thanks.
Nov 16 '05 #1
1 1188
Only if you expose the classes as managed objects. In VC++ 7.x you can do
this, but beyond simple calling of exports in DLLs C# will not talk to
anything that is not a managed library. That means you'd have to put a
wrapper around your C++ classes.

It's the same approach as COM, basically. VB6 could not talk to C++ classes
unless they were exposed somehow through COM.

--
Klaus H. Probst, MVP
http://www.vbbox.com/
"Rookie" <do***********@rediffmail.com> wrote in message
news:cf**************************@posting.google.c om...
Hi,

I was trying to link a UI I made in C# to the backend which is coded
as a DLL in VC++.

I used the DllImport attribute to invoke the dll functions. Is there
any similar mechanisms by which I can invoke member functions of
classes defined in the dll?

Is there any way I could instantiate an object of a class defined in
the dll?

I am new to C#/dll's et al so I am not too sure if these questions
make sense. But if anyone can provide some info on this and more
importantly provide pointers to articles/examples on these topics it
would be a tremendous help.

Thanks.

Nov 16 '05 #2

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

Similar topics

1
2068
by: Surendra Singhi | last post by:
Hello, When I create a dll project using Dev-C++ it creates a function like the one below: DLLIMPORT void HelloWorld () { MessageBox (0, "Hello World from DLL!\n", "Hi", MB_ICONINFORMATION); }...
15
4434
by: Jim | last post by:
I am extremely frustrated. I am building c# application for a call center and am using a third party API to access some hardware. When develop and test my class using the windows console the...
2
5768
by: Rookie | last post by:
Hi, I had a question on DllImport. On importing a function from a VC++ dll using DllImport (to a C# program), the function argument data types and the return types may be of a type that is not...
9
4946
by: Ole Christensen | last post by:
I'm trying to make a sort of conditional compilation in my C# code because my app is intended to run on both a Pocket PC and on a normal desktop PC. My code uses a call to an API function that on...
3
3445
by: Mark Jerde | last post by:
I'm sill learning VS .NET 2003, not an expert yet. I'm calling an unmanaged C++ DLL from C# using . When the whole project is done I will be calling a total of 5 C++ DLLs from C#. All the DLLs...
2
10467
by: Brian Anderson | last post by:
Hello, is it possible to use DllImport to call a DLL in ASP.NET ? Or is it necessarry that my DLL has to be copied into \System32 ? My DLL is a native C++ 7.1 DLL (not managed, no COM, no...
2
1931
by: hsharsha | last post by:
Consider the below code: extern __declspec(dllimport) int myvariable; template<const int *p> class MyClass{ public: static void myfunction(){ } }; int main(void){
1
5094
by: John Dinning | last post by:
(Using VS2005 C# and compact Framework. Target device is running CE5). I am creating a simple visual control (New Control Library project for smart device Windows CE 5), derived from Label, with...
4
2003
by: =?Utf-8?B?TGVvbg==?= | last post by:
Hi, I have a C exported function in a DLL that has the following proto-type: int _cdecl MyFunction( LPCSTR fmt, ... ); Does anyone know the DllImport declaration for this so that I can call...
1
4247
by: kardon33 | last post by:
Let me explain my problem, Im currently trying to use a Perl module that was built for a Windows OS that uses a .dll and .lib file. I have obtained the c header files that the modules were built...
0
7192
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,...
0
7064
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...
0
7261
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,...
1
6974
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...
0
5559
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,...
1
4991
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...
0
4665
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...
0
1492
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 ...
0
369
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...

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.