Hello Everyone,
I have a dll which is made in Win 32, as it is not an assembly neither COM can't be used as a refrence, so I have to Import it....
Can someone tell me how to do it...As when i do it asks for the entry point and secondly how to call the functions from that dll.....A brief example will be highly appreciATED...
Thanks,
Harsimrat

How to import a dll made in C++ Win 32
snowbound
u have to use System.Runtime.Interopservices
in your main class: do this:
[Dllimport("the dll path")]
public static extern void nume_of_function(string t\his_params);
Remeber that you have to adapt to c++ parameters..
phenshaw
public static extern function2(string t);
public static extern function3(string t);
public static extern function4(string t);
public static extern function5(string t);
like this
Ronan Jordan
Hey when u will use the dll i think you will get an exception for entryPoint.. i dont really know for myself why is doing that.. me and some others are asking this question on some other post.. so if u get that exception I DONT KNOW WHY.... (of course i get this excetion when i`m making my own dll.. maybe you know how to define an entry point)
Hacman
Yes, I still have that problem...For testing purposes I just wrote a new dll with a function to AddTwoNumbers and it just give me exception of the Entry point....
Thanks,
Harsimrat
bb32223
The exact error I'm gettiing is
Unable to find an entry point named 'AddTwoNumbers' in DLL
gcannata
You created your dll in C++ right And your still getting this entry point problem
Veejay11
=Steve D=
Suhayb
Awesome, just one more clarification..I know its Dumb....
Say My .dll has function something like this
int AddTwoNumbers( int a , int B)
{
}
Now In C# , If I my understanding properly it should be....
public static extern int AddTwoNumbers(int a, int B);
Hopefully I understood you....
Thanks,
Harsimrat
Daniel Tomasini
Harsimrat, do you think you could send me your example projects on how you are doing this I'd like to see your example C++ dll and your example C# project that you are trying to import the functions into. If you could send them to sholl76@hotmail.com I would greatly appreciate it. Maybe we can figure this thing out.
Edit: I actually got something to work using the code above, if you want me to send the project to you so you can see if I'm doing it right I will. It does seem to work.
SelArom
I tried in the way Chris mentioned in Help US Thread
Quoting User : Chris
In case that you are using functions from Win32 native DLL created from VC++, then you need to interop the API exported by the DLL to your C#. Common practice for doing this is -- put all external function declarations into one internal class, and expose then as static:
internal sealed class MyNativeMethods
{
[DllImport("myDLL.dll")]
public static extern void MyFunction();
}
This will allow you to use the functions anywhere in your project:
MyNativeMethods.MyFunction();
For me the problem still exists, I dont know why.....
I might have to make a COM wrapper around it.....
tech2hardikjoshi
Jarvism
Unfortunately, not and I'm getting the same Problem for entry Point...That was the main reason I started this thread, I was thinking that I'm dumb and there is some problem of my importing the .dll, hopefully we have that answer soon....
Secondly is there any way around that Entry point stuff....
Redfox72
The AddTwoNumbers function is in a C++ dll right
I'm having a similar problem, did you check the reply in the "Help Us" thread If so, did it work