I've got one third-party dll library which I have to work with. The following pretty simple delphi code does the job:
var
CCPActiveX:variant;
begin
CCPActiveX:=CreateOleObject('CCP.CCPActiveX');
CCPActiveX.CCP_Init('arg1','arg2');
//...
CCPActiveX:=unassigned;
end;
However I'd love to have the samething work on C#. I tried to import dll methods like this:
class CCP
{
[DllImport("CCP.dll")]
private static extern int CCP_Init(string arg1, string arg2);
public static int Init(string arg1, string arg2)
{
return CCP_Init(arg1, arg2);
}
}
However it results into Can't find DLL entry point exception.
I also tried to specify the entry point differently, say:
[DllImport("CCP.dll", EntryPoint = "CCP.CCPActiveX.CCP_Init")]
[DllImport("CCP.dll", EntryPoint = "CCPActiveX.CCP_Init")]
and so on. But nothing changed.
I tested delphi code on Windows xp x86. And the C# code - on Windows 7 x64. On both OSs the dll is sucessfully registered with regsvr32.exe. What am I doing wrong?