public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Forcing linking despite of undefined references
@ 2004-04-14 15:29 René B. Nielsen
  2004-04-15 13:58 ` llewelly
  0 siblings, 1 reply; 2+ messages in thread
From: René B. Nielsen @ 2004-04-14 15:29 UTC (permalink / raw)
  To: gcc-help

Hi,
 
TCL shells support loading of shared libraries on the fly with the "load" TCL command. The loaded library contains functions, that after the load are made available as TCL commands. Thus, there is an interaction between the shell and the shared library: The shell calls functions in the shared library, and the shared library calls functions already present in the shell to transfer results back to the shell.
 
Now, in order to build the shared library/shared object/DLL, I do the following (under Cygwin):
 
gcc -shared test.c -o libtest.dll -ltcl
 
The resulting DLL works fine as long as the tclsh is the one that comes with Cygwin, because I link with the Cygwin-enabled TCL library (-ltcl).
 
When I move to another TCL shell that has the exact same interface, it doesn't work, probably because loading libtest.dll causes a subsequent load of the Cygwin tcl.dll, which clashes with the functions inherently loaded by the TCL shell.
 
Therefore I thought of not linking with a specific TCL dll, but leave the -ltcl out, forcing the load of libtest.dll to use the TCL functions already present in whatever shell I use (provided the names of the functions and the interface is the same, of course). But this results in undefined references to "_Tcl_GetObjResult" and four other functions used in test.c. 
 
And now for the actual question: Is it possible to force gcc (or ld) to create the DLL even when there are undefined references? Or even better: Is it possible to specify the names of those functions that the linker shouldn't try to resolve?
 
Any help is highly appreciated.
 
/René Bøje Nielsen
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Forcing linking despite of undefined references
  2004-04-14 15:29 Forcing linking despite of undefined references René B. Nielsen
@ 2004-04-15 13:58 ` llewelly
  0 siblings, 0 replies; 2+ messages in thread
From: llewelly @ 2004-04-15 13:58 UTC (permalink / raw)
  To: René B. Nielsen; +Cc: gcc-help

René B. Nielsen <rbn@vitesse.com> writes:

F> Hi,
>  
> TCL shells support loading of shared libraries on the fly with the "load" TCL command. The loaded library contains functions, that after the load are made available as TCL commands. Thus, there is an interaction between the shell and the shared library: The shell calls functions in the shared library, and the shared library calls functions already present in the shell to transfer results back to the shell.
>  
> Now, in order to build the shared library/shared object/DLL, I do the following (under Cygwin):
>  
> gcc -shared test.c -o libtest.dll -ltcl
>  
> The resulting DLL works fine as long as the tclsh is the one that comes with Cygwin, because I link with the Cygwin-enabled TCL library (-ltcl).
>  
> When I move to another TCL shell that has the exact same interface, it doesn't work, probably because loading libtest.dll causes a subsequent load of the Cygwin tcl.dll, which clashes with the functions inherently loaded by the TCL shell.
>  
> Therefore I thought of not linking with a specific TCL dll, but leave the -ltcl out, forcing the load of libtest.dll to use the TCL functions already present in whatever shell I use (provided the names of the functions and the interface is the same, of course). But this results in undefined references to "_Tcl_GetObjResult" and four other functions used in test.c. 
>  
> And now for the actual question: Is it possible to force gcc (or ld)
> to create the DLL even when there are undefined references? Or even
> better: Is it possible to specify the names of those functions that
> the linker shouldn't try to resolve? 

This is really a binutils question. Try emailing binutils at gnu.org .

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-04-15 13:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-14 15:29 Forcing linking despite of undefined references René B. Nielsen
2004-04-15 13:58 ` llewelly

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).