Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2006-10

mixing C and Pascal and function pointers

4 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Armando Navarro Vázquez

Dear members:
I am not familiar with Pascal, but I would like to call some C routines inside the main Pascal program, is there any way, to pass function pointers from Pascal to the C subroutines?
Thanks in Advance
Armando

Dr. Armando Navarro-Vázquez RIAIDT. Univdade de Resonancia Magnetica Universidade de Santiago de Compostela http://desoft03.usc.es/armando/index.html

Reply by email

Wolfe, Robert
to Armando Navarro Vázquez

You may want to convert the code for the function using the h2pas or c2pas conversion utilities that are available out there to do this.

Robert Wolfe ( / )
Computer Programmer/Analyst & Web Programmer
SRDAR, Roswell Park Cancer Institute, Buffalo, New York 716-845-5788 | http://www.srdar.org

Show quoted text 23 lines
-----Original Message----- From: [mailto:fpc-pascal- On Behalf Of Armando Navarro Vázquez Sent: Thursday, October 19, 2006 7:46 AM To: Subject: [fpc-pascal] mixing C and Pascal and function pointers Dear members: I am not familiar with Pascal, but I would like to call some C routines inside the main Pascal program, is there any way, to pass function pointers from Pascal to the C subroutines? Thanks in Advance Armando -- Dr. Armando Navarro-Vázquez RIAIDT. Univdade de Resonancia Magnetica Universidade de Santiago de Compostela http://desoft03.usc.es/armando/index.html _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

This email message may contain legally privileged and/or confidential information. If you are not the intended recipient(s), or the employee or agent responsible for the delivery of this message to the intended recipient(s), you are hereby notified that any disclosure, copying, distribution, or use of this email message is prohibited. If you have received this message in error, please notify the sender immediately by e-mail and delete this email message from your computer. Thank you.

Reply by email

Leonardo M. Ram�
to Armando Navarro Vázquez: Dear members: I am not familiar with Pascal, but I would like to call some C routines…

The C routines are inside a shared library?. Can you post the "C" code to call these routines?

--- Armando Navarro Vázquez wrote 16 lines
Dear members: I am not familiar with Pascal, but I would like to call some C routines inside the main Pascal program, is there any way, to pass function pointers from Pascal to the C subroutines? Thanks in Advance Armando -- Dr. Armando Navarro-Vázquez RIAIDT. Univdade de Resonancia Magnetica Universidade de Santiago de Compostela http://desoft03.usc.es/armando/index.html _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Leonardo M. Ramé
http://leonardorame.blogspot.com

__________________________________________________ Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com

Reply by email

Ken G. Brown

I've been experimenting with calling C routines in a library from Pascal. This seems to work:

In the Pascal source do

Procedure croutine;	cdecl; alias : '_croutine'; External;

If there is trouble finding the routines when building, you can give the location of the routines in the Pascal source file with:

{$L libcroutines.a}

When compiling, the 'lib' is automatically added to the front of the file name for the library source.

So far I have passed an SInt32 to the C routines so maybe you could pass the appropriately sized variable.

Good luck.
Ken

Show quoted text 33 lines
Date: Thu, 19 Oct 2006 07:44:30 -0700 (PDT) From: "Leonardo M. RamÈ" Subject: Re: [fpc-pascal] mixing C and Pascal and function pointers To: FPC-Pascal users discussions Message-ID: Content-Type: text/plain; charset=iso-8859-1 The C routines are inside a shared library?. Can you post the "C" code to call these routines? --- Armando Navarro V·zquez wrote: > > Dear members: > I am not familiar with Pascal, but I would like to call some C routines inside > the main Pascal program, is there any way, to pass function pointers from > Pascal to the C subroutines? > Thanks in Advance > Armando > -- > Dr. Armando Navarro-V·zquez > RIAIDT. Univdade de Resonancia Magnetica > Universidade de Santiago de Compostela > http://desoft03.usc.es/armando/index.html > _______________________________________________ > fpc-pascal maillist - > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > Leonardo M. RamÈ http://leonardorame.blogspot.com __________________________________________________

Reply by email