help dll

 

hello
pls help me

i have a dll,
i want to create dll,how i can call fuctions of frist dll from my dll
I am a delphi developer
pls help me by example

thank you


 
here are examples for Pascal programmers (and everything from this thread also applies to C programmers): http://www.forexfactory.com/showthread.php?t=219576
 
7bit,you are great delphi developer

but i want :
calling dll from another dll

for example

i have

fifa.dll her fuctions is

string version(string name,int date);

i want to call this function from another dll,but in delphi

i want to hide this function in another dll for example or i rename it

thank you
 
What is "string"? Is it a C++ string object? Or is it a simple PChar?
 

yes my dear 7bit, it is created by c++

fifa.dll is created by C++;

 
yes i PChar in delphi
 
function version(name: PChar; date: Integer): PChar; external "fifa.dll"; cdecl;

or

function version(name: PChar; date: Integer): PChar; external "fifa.dll"; stdcall;

depends on whether the dll is cdecl (probably) or stdcall (mostly only winapi dlls)

put this line into your interface section and you can use the function.


But you have to take care who is responsible for freeing (or supposed to free) the memory that is used for the strings. You could accidentally create a memory leak here if you don't know exactly what is going on and how the function is supposed to be used and who owns the strings.

 

thank you 7bit you are very great delphi devloper

pls i am a rigth ?

library Project2;

uses
SysUtils,
Classes;

function version(name: PChar; date: Integer): PChar; external "fifa.dll"; stdcall;

function vvv(name: PChar; date: Integer): PChar; stdcall;
begin
Result :=version(name;500);
end;

exports
vvv;

begin
end.

 
Yes, something like this might work.
 
thank you very much my friend 7bit
 
maybe you need single quotes 'fifa.dll' unstead of "fifa.dll", I have been doing some mql4 last week and no Pascal for 2 months and when I switch between programming languages I always need an hour until I have my automatic reflexes fully adapted to the tiny syntax differences.