开发者

Use C# DLL as COM under Delphi

We got a DLL written by C# programmers, compiled to usable as COM object.

We consult these developers to get the function names, and syntaxes, and we can use it after we registered it with regasm.

This is ok, but we have more questions to produce faster development (on changes), and some things are not understandabl开发者_如何学Ce or not working.

We used Delphi 6 professional, and assembly made by C# Visual Studio 2008 (as I think).

Let's see them:

1.) I cannot use the typelib (TLB) of the C# code, because I cannot import into Delphi.

The result was:

"Hiba az OLE beállításjegyzék használata közben."

Translate ~ "Error occured on use OLE typelib/setting lib"

Possible sources of the error:

a.) Delphi 6 cannot import the new COM dll-s.

b.) We must force to C# generate an older formatted TLB.

We tried to re-generate the TLB with regasm, but we also got this error.

May this impossable, but if case b.) happens, what we need to say to C# developers - how to compile the DLL-s?

(DLL-s are unimportable by Delphi, because they don't have self init section).

2.) Interesting: All of the parameters correctly converted into variants vica-versa, but if the C# method does not have parameter, I got error in Delphi side... For example (pseudo):

proc A():bool;

Calling of A is generating an error in Delphi side.

proc A(Dummy: bool):bool;

Calling of A(False) is working fine.

I don't know, why we got this. What do you thing about this? Is this a C# compiling problem?

Thanks for your help: dd


Best route here is to obtain source code showing the successful use of the DLL via COM using, say, C#. The developers of the DLL should be able to provide that. The DLL probably also has to be registered with regasm (not regsvr32.exe as it would be for a native COM DLL) before it will be accessible via COM. As always, without more actual code, it is very difficult to answer such questions.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜