Board index » delphi » call DLL inside pascal's code

call DLL inside pascal's code

how can i call a DLL (compiled with VC or other) in a pascal code?
I know the technic with VB, LABVIEW, MATLAB and SCILAB, and i think that i
will need of the technik.

thank you

nicolas

 

Re:call DLL inside pascal's code


Quote
Utilisateur1 wrote:

> how can i call a DLL (compiled with VC or other) in a pascal code?
> I know the technic with VB, LABVIEW, MATLAB and SCILAB, and i think
> that i will need of the technik.

You are asking for something that is not covered in the various
standards.  So such action, if possible at all, is dependant on
your particular system.

DLLs are usually associated with some form of Windows executing on
x86 processors.

The only language that has specific standardized abilities to
connect to other languages is, AFAIK, Ada.

--
Chuck F (cbfalco...@yahoo.com) (cbfalco...@worldnet.att.net)
   Available for consulting/temporary embedded and systems.
   <http://cbfalconer.home.att.net>  USE worldnet address!

Re:call DLL inside pascal's code


Quote
Utilisateur1 wrote:

> how can i call a DLL (compiled with VC or other) in a pascal code?
> I know the technic with VB, LABVIEW, MATLAB and SCILAB, and i think that i
> will need of the technik.

> thank you

> nicolas

Its language specific and you are not in a very language specific group. However,
its obvious you mean Windows, and the defacto interface language of Windows is
C, and the defacto calling convention is left to right stack with function returns
in eax. Ie., a call of "function biteme(a, b, c: integer): integer;" will have on
the stack the return address, followed by a, then b, then c, and you will get
the result back in eax, and the call will be "self cleaning", that is, the dll
will remove the stack parameters for you (sometimes confusingly called "Pascal
calling convention".. it has nothing whatever to do with Pascal).

Now, you didn't mention your Pascal type either, but virtually all Pascals that
run under windows use or can be made to use the standard system calling convention(*),
you might have to specify something like "procedure x; system" or suchlike.

So find in your Pascal documentation where they talk about calling the Windows
system, then use the same method to call your .dll.

Enjoy, and for further questions come back to us with your Pascal type please, it
will help us help you.

* - Except IP Pascal, which uses a translation layer to do that.

Other Threads