Link Gcc lib with Watcom program

Hello,

I try to link a static archive library builed with Gcc with a main program
compiled with Watcom 10.6 on Qnx 4 (not neutrino).
I have some trouble, is it possible to do that? Someone has already do that?

Thanks for answer.

Jean -Pierre

“Coudert” <jcoudert@ai.polymtl.ca> wrote in
news:9tu2jv$qvd$1@inn.qnx.com:

I try to link a static archive library builed with Gcc with a main
program compiled with Watcom 10.6 on Qnx 4 (not neutrino).

Try using stack-based calling convention. Look at the -3s option
for details.

“Operating System Tech Support” <os@qnx.com> wrote in
news:9u0af2$ffb$1@nntp.qnx.com:

“Larry Martin” <> Larry@syatech-no-spam-here.com> > wrote in message
news:9tuij5$6sp$> 1@inn.qnx.com> …
“Coudert” <> jcoudert@ai.polymtl.ca> > wrote in
news:9tu2jv$qvd$> 1@inn.qnx.com> :
I try to link a static archive library builed with Gcc with a main
program compiled with Watcom 10.6 on Qnx 4 (not neutrino).

Try using stack-based calling convention. Look at the -3s option for
details.

The stack calling convention doesn’t have any effect/bearing on the
link stage. The QNX4 binary will not run under QNX6, nor are the
compiled object files cross-compatible (by default, AFAIK). It may be
possible to recompile the objects in your library into COFF format, and
then perhaps link using the Watcom linker (but that begs the question,
if you have the source for the lib, why not just compile it under
Watcom in the first place).

Huh? Who’s asking anything about QNX6? This is qdn.public.qnx4, and
the orginal poster asked about Watcom 10.6 and GCC libraries on Qnx 4.

Without the ‘-3s’ option the Watcom compiler will use its register-
based calling convention, and generate underscore postfix, rather than
prefix for identifiers. This causes all kinds of link problems because
GCC uses the “normal” C stack-based calling convention, and prefixes
an underscore to identifiers. This is what I assumed the original
poster was having trouble with.

I ran into the this issue using PostgreSQL on QNX4. The PostgreSQL
binaries and interface libraries are all compiled with GCC. If you
want to link the interface libraries into your Watcom 10.6 applications
you can use the ‘-3s’ (or -4s, -5s, etc.) options for Watcom. This
generates code with the same calling conventions as GCC, and the
Watcom linker works just fine with the GCC libraries. (You’ll need
to link against libgcc.a too, to resolve all the various GCC
library/support routines.)

I agree that most things can be made to re-compile under Watcom, but
sometimes it just isn’t worth the trouble. I’d normally just use
GCC for my stuff too and avoid the whole issue, but with QNX4 that
isn’t always possible. (Unless someone has built a library of QNX4-
specific system calls for GCC…)

  • Larry

“Larry Martin” <Larry@syatech-no-spam-here.com> wrote in message
news:9tuij5$6sp$1@inn.qnx.com

“Coudert” <> jcoudert@ai.polymtl.ca> > wrote in
news:9tu2jv$qvd$> 1@inn.qnx.com> :
I try to link a static archive library builed with Gcc with a main
program compiled with Watcom 10.6 on Qnx 4 (not neutrino).

Try using stack-based calling convention. Look at the -3s option
for details.

The stack calling convention doesn’t have any effect/bearing on the link
stage. The QNX4 binary will not run under QNX6, nor are the compiled object
files cross-compatible (by default, AFAIK). It may be possible to recompile
the objects in your library into COFF format, and then perhaps link using
the Watcom linker (but that begs the question, if you have the source for
the lib, why not just compile it under Watcom in the first place).

-Adam

Huh? Who’s asking anything about QNX6? This is qdn.public.qnx4, and
the orginal poster asked about Watcom 10.6 and GCC libraries on Qnx 4.

I miss-read the post - sorry.

Without the ‘-3s’ option the Watcom compiler will use its register-
based calling convention, and generate underscore postfix, rather than
prefix for identifiers. This causes all kinds of link problems because
GCC uses the “normal” C stack-based calling convention, and prefixes
an underscore to identifiers. This is what I assumed the original
poster was having trouble with.

True, since i miss read the post, my post is invaild.

Sorry about that.

-Adam