Delphi에서 .NET 어셈블리 (Position.dll)에 액세스하려고하는데 COM 유형 라이브러리로 가져옵니다. 모든 것은 OK를 가져 오는 것처럼 보이지만 결과로 생긴 Position_TLB.pas 파일에는 클래스를 생성하는 함수 만 포함됩니다. 클래스 메서드 나 대리자는 가져 오지 않습니다..NET 어셈블리 유형 라이브러리를 Delphi로 가져 오지 않아도 프로 시저가 생성되지 않습니다.
내가하는 일은 다음과 같습니다.
1) Position.dll 어셈블리를 GAC에 추가하십시오.
IID__MyClass: TGUID = '{F53EAE3D-9EB8-1111-B1F7-5DB609FDBEAE}';
CLASS_MyClass: TGUID = '{E15581CD-FFF5-34CE-3434-D5484798900F}';
...
_MyClass = interface;
_MyClassDisp = dispinterface;
MyClass = _MyClass;
// *********************************************************************//
// Interface: _MyClass
// Flags: (4432) Hidden Dual OleAutomation Dispatchable
// GUID: {F53EAE3D-9EB8-1111-B1F7-5DB609FDBEAE}
// *********************************************************************//
_MyClass = interface(IDispatch)
['{F53EAE3D-9EB8-1111-B1F7-5DB609FDBEAE}']
end;
...
// *********************************************************************//
// DispIntf: _MyClassDisp
// Flags: (4432) Hidden Dual OleAutomation Dispatchable
// GUID: {F53EAE3D-9EB8-3538-B1F7-5DB609FDBEAE}
// *********************************************************************//
_MyClassDisp = dispinterface
['{F53EAE3D-9EB8-1111-B1F7-5DB609FDBEAE}']
end;
...
// *********************************************************************//
// The Class CoMyClass provides a Create and CreateRemote method to
// create instances of the default interface _P2100 exposed by
// the CoClass P2100. The functions are intended to be used by
// clients wishing to automate the CoClass objects exposed by the
// server of this typelibrary.
// *********************************************************************//
CoMyClass = class
class function Create: _MyClass;
class function CreateRemote(const MachineName: string): _MyClass;
end;
...
class function CoMyClass.Create: _MyClass;
begin
Result := CreateComObject(CLASS_MyClass) as _MyClass;
end;
class function CoMyClass.CreateRemote(const MachineName: string): _MyClass;
begin
Result := CreateRemoteComObject(MachineName, CLASS_MyClass) as _MyClass;
end;
:
gacutil.exe -i Position.dll
2)
모든 수입 클래스는 다음과 같이 보일 형식 라이브러리로 델파이로 가져 오기) 어셈블리를 조립
regasm.exe Position.dll
3 등록 MyClass에는 TLB 파일에 표시되지 않는 여러 가지 메서드와 대리자가 있어야합니다.
내가 뭔가를 분명 실종 : 여기
내가 클래스 코드 완성을하려고하면 내가 볼 무엇인가?
클래스에 [ComVisible (true)] 및 [[ClassInterface (ClassInterfaceType.AutoDual)] 속성을 모두 선언 했습니까? –
출처에 대한 액세스 권한이 없습니다. 제 3 자 DLL입니다. – norgepaul
어셈블리가 COM에 대한 클래스 메서드를 액세스하지 않도록 내보내는 경우 [CrossTalk] (http://www.atozed.com/CrossTalk/index.EN)와 같은 타사 프레임 워크를 사용하지 않는 한 운이 없어진 것입니다. .aspx). –