using win32 dll in c# ?

  • Thread starter Thread starter chandu
  • Start date Start date
C

chandu

hello,

i want to use win32 dll in my c# application.i copied that dll in my
bin/debug folder and then i used one of its function like this......
[DllImport("XCENLogInterface.dll")]

public static extern void SetPatientLogFileName(string pPatientLogFileName);

if i call this method it is giving exception

"Entry point not found Exception".

Then i used like this:

[DllImport("XCENLogInterface.dll", EntryPoint = "SetPatientLogFileName",
CharSet = CharSet.Auto)]

public static extern void SetPatientLogFileName(string pPatientLogFileName);

even also i am getting problem.

can any one send inforamation regarding using an existing win32 dll in my c#
applicatin?

thanks
 
Hi

What problems are u getting after especify the entry point?
 
i am getting same problem
"Entry Point NotFound Exception.

Ignacio Machin ( .NET/ C# MVP ) said:
Hi

What problems are u getting after especify the entry point?


chandu said:
hello,

i want to use win32 dll in my c# application.i copied that dll in my
bin/debug folder and then i used one of its function like this......
[DllImport("XCENLogInterface.dll")]

public static extern void SetPatientLogFileName(string
pPatientLogFileName);

if i call this method it is giving exception

"Entry point not found Exception".

Then i used like this:

[DllImport("XCENLogInterface.dll", EntryPoint = "SetPatientLogFileName",
CharSet = CharSet.Auto)]

public static extern void SetPatientLogFileName(string
pPatientLogFileName);

even also i am getting problem.

can any one send inforamation regarding using an existing win32 dll in my
c# applicatin?

thanks
 
i want to use win32 dll in my c# application.i copied that dll in my
bin/debug folder and then i used one of its function like this......
[DllImport("XCENLogInterface.dll")]

public static extern void SetPatientLogFileName(string pPatientLogFileName);

if i call this method it is giving exception

"Entry point not found Exception".

In what language was the DDL built?
Was the DLL built using Visual C++? And what calling convention was
used?

This is because Visual C++ decorates DLL function identifiers.
If you use __cdecl calling convention, a leading underscore is
introduced.
If you use __stdcall, the decoration is as follow: leading underscore
(_) and a trailing at sign (@) followed by a number representing the
number of bytes in the parameter list.
So, "int func( int a, double b )" is decorated as follows: "_func@12".

You might want to see:

<http://msdn2.microsoft.com/en-us/library/x7kb4e2f(VS.71).aspx>

So, I suspect that the actual entry point of your DLL function is not
"SetPatientLogFileName", but something different, like
"_SetPatientLogFileName" (with a leading underscore), or something
with the @ sign...

I would use DUMPBIN /EXPORTS <your dll> to see the actual exported
identifiers.

Mr.Asm
 
i want to use win32 dll in my c# application.i copied that dll in my
bin/debug folder and then i used one of its function like this......
[DllImport("XCENLogInterface.dll")]

public static extern void SetPatientLogFileName(string pPatientLogFileName);

if i call this method it is giving exception

"Entry point not found Exception".

In what language was the DDL built?
Was the DLL built using Visual C++? And what calling convention was
used?

This is because Visual C++ decorates DLL function identifiers.
If you use __cdecl calling convention, a leading underscore is
introduced.
If you use __stdcall, the decoration is as follow: leading underscore
(_) and a trailing at sign (@) followed by a number representing the
number of bytes in the parameter list.
So, "int func( int a, double b )" is decorated as follows: "_func@12".

You might want to see:

<http://msdn2.microsoft.com/en-us/library/x7kb4e2f(VS.71).aspx>

So, I suspect that the actual entry point of your DLL function is not
"SetPatientLogFileName", but something different, like
"_SetPatientLogFileName" (with a leading underscore), or something
with the @ sign...

I would use DUMPBIN /EXPORTS <your dll> to see the actual exported
identifiers.

Mr.Asm

Thank you!

Good luck with your project,

Otis Mukinfus
http://www.arltex.com
http://www.tomchilders.com
 
Back
Top