Đã Đóng

C# integration with COM component in Delphi

Hello,

I trying to write a software in C# that make calls in a .dll wrote in Delphi.

Im trying to call this method (wrote in delphi):

-------------

Function Recebe_Cartao (var Matriz : array [ 1..721 ] of char) : boolean

-------------

In my C# code, I declare like this:

---------------

[DllImport("[url removed, login to view]", CharSet = [url removed, login to view])]

public static extern bool Recebe_Cartao( char[][] data);

---------------

The problem is when I call in C# this method in my console application:

------------

Recebe_Cartao(RetornoMatriz);

-------------

I get an error: Cannot marshal 'parameter #1': There is no marshaling support for nested arrays.

I found a solution in: [url removed, login to view] but I still dont know how to fix my code.

You can download my project in: [url removed, login to view]

Main objective: I need loop through all values of RetornoMatriz array.

Thanks

Marcelo

I changed my project in www.csharp.com.br/leitora.zip

Now I declare:

[DllImport("lc3000.dll", CharSet = CharSet.Unicode)]
public static extern bool Recebe_Cartao( out char[] data);

I get this error:

he runtime has encountered a fatal error. The address of the error was at 0x6390a520, on thread 0x1c2c. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.

Kỹ năng: Lập trình C#, Delphi, Kiến trúc phần mềm

Xem thêm: char marshal parameter marshaling support nested arrays, marshaling support nested arrays, www programming software com, thread programming, static programming, sharp component, public programming, programming loop, programming in objective c, programming in delphi, programming forums, programming Delphi, programming array, objective programming, objective of c programming, objective c com, loop programming, how to write an objective, how to fix com, get in c programming, function in programming, for loop in c programming, for loop c programming, c programming static, c programming for loop

Về Bên Thuê:
( 5 nhận xét ) So Paulo, Brazil

Mã Dự Án: #1667095

4 freelancer đang chào giá trung bình $63 cho công việc này

AlosDeveloper

Hello, i have 11 years experince in Delphi and C#. Please attach project from Delphi too.

$100 USD trong 1 ngày
(43 Đánh Giá)
6.8
kissattila

The test program has a lot of communication errors, but I think it was problem with the declaration...

$50 USD trong 1 ngày
(0 Đánh Giá)
0.0
huyensonus

I fixed it. Plz read private message

$50 USD trong 0 ngày
(0 Đánh Giá)
0.0
rajeemcariazo

I believe my skills and experience are relevant for the task.

$50 USD trong 1 ngày
(0 Đánh Giá)
0.0