win32 dll & c#
-
hii all, i got starnge problem. i made dll's with win32 and while i was calling them from c# application for example [DllImport("DLL.dll",EntryPoint="DLLMain")] public static extern int Sum(int x,int y); i got exception said DLLMain entry point not exists. and even when i removed it says Sum not found. even that entry point is supposed to be defined by linker. and the prototype of sum is extern int Sum(int x, int y); so why it can't see it. marcoryos
-
hii all, i got starnge problem. i made dll's with win32 and while i was calling them from c# application for example [DllImport("DLL.dll",EntryPoint="DLLMain")] public static extern int Sum(int x,int y); i got exception said DLLMain entry point not exists. and even when i removed it says Sum not found. even that entry point is supposed to be defined by linker. and the prototype of sum is extern int Sum(int x, int y); so why it can't see it. marcoryos
Your EntryPoint should be the name of the function your trying to call in the DLL. If the function name in the DLL is Sum, then the EntryPoint should specify that.
[DllImport("DLL.dll", EntryPoint="Sum")]
public static extern int Sum(int x, int y);If you wanted to change the name of the name of the function inside your application, you could do that also:
[DllImport("DLL.dll", EntryPoint="Sum")]
public static extern int DllSumFunction(int x, int y);Now, the Sum function in the DLL would be called by the name DllSumFunction in your code. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
Your EntryPoint should be the name of the function your trying to call in the DLL. If the function name in the DLL is Sum, then the EntryPoint should specify that.
[DllImport("DLL.dll", EntryPoint="Sum")]
public static extern int Sum(int x, int y);If you wanted to change the name of the name of the function inside your application, you could do that also:
[DllImport("DLL.dll", EntryPoint="Sum")]
public static extern int DllSumFunction(int x, int y);Now, the Sum function in the DLL would be called by the name DllSumFunction in your code. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome