Fórum Chamar DLL feita em delphi no Node.js #613914
28/01/2021
0
Estou querendo (para fins de aprendizado inicialmente) consumir uma DLL simples feita em delphi (usei o exemplo do link
No Node tentei chamar de algumas formas, mas não obtive sucesso. Alguém sabe me indicar a melhor forma de fazer isso?
Já tentei seguir algumas formas que achei pesquisando, mas não obtive sucesso. Segue abaixo exemplo de tentativa em Node:
Forma 1
--> npm install edge
--> npm install edge-js
Forma 2
Se alguém tiver alguma idéia de como fazer e puder compartilhar, será de grande ajuda.
Desde já, obrigado!
https://www.devmedia.com.br/artigo-clube-delphi-102-desenvolvendo-dlls/11770
para criar a DLL)function MeuIntToStr(Numero: Integer): ShortString;stdcall; begin Result := IntToStr(Numero); end; function MeuUpperCase(s: ShortString): ShortString; stdcall; begin Result := UpperCase(s); end; function MeuLowerCase(s: WideString): ShortString; stdcall; begin Result := LowerCase(s); end; exports MeuUpperCase, MeuLowerCase, MeuIntToStr;
No Node tentei chamar de algumas formas, mas não obtive sucesso. Alguém sabe me indicar a melhor forma de fazer isso?
Já tentei seguir algumas formas que achei pesquisando, mas não obtive sucesso. Segue abaixo exemplo de tentativa em Node:
Forma 1
--> npm install edge
--> npm install edge-js
var edge = require('edge-js');
var RetornoFunc = edge.func({
assemblyFile: 'MinhaDLL.dll',
methodName: 'MeuUpperCase',
arguments: 'ola'
});
console.log(`resp: $`)
Forma 2
var spawn = require ('child_process').spawn;
console.log('1')
var posProc = spawn ('MinhaDLL.dll', ['MeuUpperCase', 'ola']);
console.log('2')
posProc.stdout.once ('dados', function (dados) {
// escreva de volta no objeto de resposta
console.log(`Dados: $`)
});
console.log('3')
posProc.on ('saída', function (code) {
console.log(`saída: $`)
});
Se alguém tiver alguma idéia de como fazer e puder compartilhar, será de grande ajuda.
Desde já, obrigado!
Atma Ltda
Curtir tópico
+ 0
Responder
Clique aqui para fazer login e interagir na Comunidade :)