Dynamic link between Pascal .so file and executable file sourced in gcc 
Author Message
 Dynamic link between Pascal .so file and executable file sourced in gcc

Hi all,

Does anyone knows if I can use Pascal to create Shared Library (.so) file,
to be use it by an executable, that itself was created using gcc, all under
Unix Solaris 2.6?

Note that I actually link a (sourced in Pascal) object to another object
(sourced in gcc) is there any function call contention or miss-alignment
between Pascal and gcc?

Thanks all for any input,

Teddy



Sat, 19 Apr 2003 17:27:52 GMT  
 Dynamic link between Pascal .so file and executable file sourced in gcc


Quote:
>Does anyone knows if I can use Pascal to create Shared Library (.so) file,
>to be use it by an executable, that itself was created using gcc, all under
>Unix Solaris 2.6?

>Note that I actually link a (sourced in Pascal) object to another object
>(sourced in gcc) is there any function call contention or miss-alignment
>between Pascal and gcc?

Which Pascal compiler are you using/proposing to use?
--
Martin Liddle, Tynemouth Computer Services, 27 Garforth Close,
Cramlington, Northumberland, England, NE23 6EW.
Phone: 01670-712624.  Fax: 01670-717324.


Sat, 19 Apr 2003 19:35:38 GMT  
 Dynamic link between Pascal .so file and executable file sourced in gcc
Dear Martin: By you question, I understand that the compile type make a
difference - Is it so? My question is in general since we do not have this
situation right now, but we might run into one and I have to know if it will
work. Which Compiler should I use? Which compiler can produce code from
Pascal to be Dynamically linked to an executable?
Thanks, Teddy

Quote:


> >Does anyone knows if I can use Pascal to create Shared Library (.so)
file,
> >to be use it by an executable, that itself was created using gcc, all
under
> >Unix Solaris 2.6?

> >Note that I actually link a (sourced in Pascal) object to another object
> >(sourced in gcc) is there any function call contention or
miss-alignment
> >between Pascal and gcc?

> Which Pascal compiler are you using/proposing to use?
> --
> Martin Liddle, Tynemouth Computer Services, 27 Garforth Close,
> Cramlington, Northumberland, England, NE23 6EW.
> Phone: 01670-712624.  Fax: 01670-717324.



Sat, 19 Apr 2003 23:00:05 GMT  
 Dynamic link between Pascal .so file and executable file sourced in gcc


Quote:
>Dear Martin: By you question, I understand that the compile type make a
>difference - Is it so? My question is in general since we do not have this
>situation right now, but we might run into one and I have to know if it will
>work. Which Compiler should I use? Which compiler can produce code from
>Pascal to be Dynamically linked to an executable?

I think the compiler could be important.  I know that changes had to be
made to the EPC Pascal-E compiler which we used to use before it was
capable of producing shared libraries.  We are currently using Gnu
Pascal (gpc) and it sounds plausible to me that this will work but I
haven't actually done it.  I'll stand aside and let one of the gpc gurus
answer.
--
Martin Liddle, Tynemouth Computer Services, 27 Garforth Close,
Cramlington, Northumberland, England, NE23 6EW.
Phone: 01670-712624.  Fax: 01670-717324.


Sat, 19 Apr 2003 23:19:50 GMT  
 Dynamic link between Pascal .so file and executable file sourced in gcc

Quote:



> >Dear Martin: By you question, I understand that the compile type make a
> >difference - Is it so? My question is in general since we do not have this
> >situation right now, but we might run into one and I have to know if it will
> >work. Which Compiler should I use? Which compiler can produce code from
> >Pascal to be Dynamically linked to an executable?

> I think the compiler could be important.  I know that changes had to be
> made to the EPC Pascal-E compiler which we used to use before it was
> capable of producing shared libraries.  We are currently using Gnu
> Pascal (gpc) and it sounds plausible to me that this will work but I
> haven't actually done it.  I'll stand aside and let one of the gpc gurus
> answer.

Yes, it's possible. First, the calling conventions between GPC and
GCC are the same, and all C types have direct GPC equivalents
(though not vice versa -- e.g., C doesn't support Pascal strings, so
you should probably pass strings as C strings), and GPC allows you
(using `asmname') to specify the C name of functions and variables.

Creating shared libs from object files compiled by GPC works just
like for C object files (i.e., there's no special support for that
in GPC beyond what GCC does, but it can be done with
`gcc -shared...' or using libtool, I suppose, though I haven't tried
the latter).

It's even possible to build shared libs from mixed Pascal and C
object files. In fact, the run time system (libgpc) can be built as
a shared library (I've tested it for Linux and Solaris). This is not
done by default until the interface stabilizes more, to avoid
versioning problems, but if you want to try it with the run time
system, build GPC from the sources, giving `WITH_SHARED=yes' to the
make command line.

Frank

--

PGP and GPG keys:           http://fjf.gnu.de/plan
Pascal code, BP CRT bugfix: http://fjf.gnu.de/programs.html
Free GNU Pascal Compiler:   http://home.pages.de/~GNU-Pascal/



Sun, 20 Apr 2003 06:49:53 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Linking BGI files into Executables

2. Creating executable file + file handling "objects"

3. Linked file was : Writning to a file

4. Linked file was : Writning to a file

5. BGI file linked in EXE file?

6. Info on how to run an executable from a pascal compiled executable

7. Executing DOS batch files (or any other program files) and deleting files with PASCAL

8. Paradox 7 Can I make Executable Files

9. simple executable program to view/print RTF file

10. Executable files

11. Executables with DBase IV files

12. Executable Files

 

 
Powered by phpBB® Forum Software