Problem with delphi dll

P

Piotr Nabielec

Hi,

I have very big problem with importing delphi dll into C# project...
I got a Velleman K8000 card with k8d.dll that makes all communication
for me. Now I'm trying to import it into C#, but I cannot get it
worked...
(I'm not quite sure if it is delphi dll!)

Everything about it you can see at:
http://zeus.polsl.gliwice.pl/~eloy/csharp/

There is k8d.dll which I would like to use.
There is also original delphi code that uses this library and this
code WORKS (i can see lights flashing in front of me!)

Problem is that I import this dll into my code in C# using DllImport
like this one (DACCard.cs file that can be found in given directory)
[DllImport("k8d.dll", EntryPoint = "Start_K8000", ExactSpelling =
true,
CallingConvention = CallingConvention.StdCall, CharSet=CharSet.Ansi)]
public static extern void Start();

When I change just one letter in EntryPoint, runtime environment says
that this function couldn't be found in dll, so it seems to work...
But - I use the code below:
DACCard.Start();
DACCard.ConfigAllIOAsOutput();
DACCard.SetAllIO();
(file Form1.cs, button1click)

and while debugging each line I can see nothing happening.

I read all the delphi code and it seems that these 3 lines should
work.

How can I ensure that this dll is called and maybe trace into it ?!
I'm familiar with assembler, so I can check what's the problem.

First I thought that it is the problem with type sizes. So I checked
delphi type sizes and they match.
Even if they don't match I tried to use only void methods that don't
take any parameters. Still doesn't work.

Please help me, if you can.

Regards

Peter
 
N

Nick Malik

Sorry Piotr,

Not a lot of experience with that particular DLL. May I suggest that the
vendor who wrote the dll may have some experience is hooking the DLL to
C#... maybe they can send you a snippet of code if you contact them
directly.

Hope this helps,
--- Nick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top