Senhores,
Criei uma DLL de teste com dois métodos.
Um executa um método em uma DLL de terceiro e retorna a versão da DLL.
O outro método apresenta a mensagem enviada como parâmetro.
no C# tudo está funcionando.
Agora estou criando o arquivo tlb para realizar a interoperabilidade com o linguagem Dataflex e a princípio o arquivo é gerado sem problema.
O Problema ocorre quando "importo" o arquivo tlb para o Dataflex. Ao olhar arquivo gerado, as funções sitadas acima não existe (veja arquivo abaixo).
Alguém sabe o porque não gerou as funções?
Use FlexCom20.pkg
// CLSID: {65074F7F-63C0-304E-AF0A-D51741CB4A8D}
Class cCom_Object is a Mixin
{ MethodType=Property DesignTime=False }
Function ComToString Returns String
Handle hDispatchDriver
String retVal
Get phDispatchDriver to hDispatchDriver
Get InvokeComMethod of hDispatchDriver 0 OLE_VT_BSTR to retVal
Function_Return retVal
End_Function
Function ComEquals Variant llobj Returns Boolean
Handle hDispatchDriver
Boolean retVal
Get phDispatchDriver to hDispatchDriver
Send PrepareParams to hDispatchDriver 1
Send DefineParam to hDispatchDriver OLE_VT_VARIANT llobj
Get InvokeComMethod of hDispatchDriver 1610743809 OLE_VT_BOOL to retVal
Function_Return retVal
End_Function
Function ComGetHashCode Returns Integer
Handle hDispatchDriver
Integer retVal
Get phDispatchDriver to hDispatchDriver
Get InvokeComMethod of hDispatchDriver 1610743810 OLE_VT_I4 to retVal
Function_Return retVal
End_Function
Function ComGetType Returns Variant
Handle hDispatchDriver
Variant retVal
Get phDispatchDriver to hDispatchDriver
Get InvokeComMethod of hDispatchDriver 1610743811 OLE_VT_UNKNOWN to retVal
Function_Return retVal
End_Function
End_Class
// CoClass
// ProgID: NFe_DLL.NFeDLL
// CLSID: {B6B837E4-AD42-4DF5-A89D-1E0EB39416CC}
Class cComNFeDLL is a cComAutomationObject
Import_Class_Protocol cCom_Object
Procedure Construct_Object
Forward Send Construct_Object
Set psProgID to "{B6B837E4-AD42-4DF5-A89D-1E0EB39416CC}"
Set peAutoCreate to acNoAutoCreate
End_Procedure
End_Class
Classe do C#:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace NFe_DLL
{
[Guid("B6B837E4-AD42-4DF5-A89D-1E0EB39416CC")]
[ClassInterface(ClassInterfaceType.None)]
//[ProgId("NFeDLL")]
public class NFeDLL : INFeDLL
{
public string Versao()
{
NFe_Util_2G.Util _NFeDll = new NFe_Util_2G.Util();
return (_NFeDll.Versao());
}
public void ExibirMensagem()
{
MessageBox.Show("Chamada de DLL.");
}
}
}
Interface no C#:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
namespace NFe_DLL
{
[Guid("B6B837E4-AD42-4DF5-A89D-1E0EB39416CC")]
interface INFeDLL
{
string Versao();
void ExibirMensagem();
}
}
Obrigado,
Renato Mello