delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/07/03/07:31:17

From: geier AT forwiss DOT uni-passau DOT de (Roland Geier)
Subject: Loading dll dynamically into Tcl-Interpreter???
3 Jul 1997 07:31:17 -0700 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <199707031354.PAA18181.cygnus.gnu-win32@bombadill.forwiss.uni-passau.de>
Mime-Version: 1.0
Original-To: gnu-win32 AT cygnus DOT com
X-Face:
%JjDwL,CM#gbv*uICrNLdM9yk_LRxMh3DV'.fQ>iw'N;7([Jq}2|J#5o".kzM&>7tW`8T^Z
buvRLp?jvQ+sbD3BND%=&D: lT%vT4p7cGcGRP5JO+F'^
X-Mailer: ELM [version 2.4ME+ PL31 (25)]
Original-Sender: owner-gnu-win32 AT cygnus DOT com

Hi!

I finally succeeded in building a dll from some of my
unix-c++-sources. Under Unix I build a '.so' from the same sources and
load the Shared Library into a runnig 'tclsh76' via the tcl-'load'-command
(to be precise, I use the package-mechanism). After bulding a dll with
gnuwin32 I have problems to load it into a tclsh under NT. That's how
the error looks like:

: 216 MIRACULIX:/OBJ>
: tclsh76
: % load DateTime.dll
: couldn't find procedure Datetime_Init
: % exit

But the symbol Datetime_Init exists in the dll as a 'nm'-run can proove:

: 216 MIRACULIX:/OBJ>
: > nm DateTime.dll | c++filt | grep Init
: 10001d70 T _Datetime_Init(Tcl_Interp *)
: 1000165c T Date::_InitializeEpoch(void)
: 100020bc T Time::_Initialize(void)
: 1001200c D __4Date$epochInitialized
: 10002e9c T ios::Init::_(void)

Thus, though the function 'Datetime_Init' does exist in the dll, the
tcl-load-command cannot find it. Remind that the same procedure works
fine under Unix.

Here is the source-code for my 'Datetime_Init'-function:

int Datetime_Init _ANSI_ARGS_((Tcl_Interp *interp)); 

int 
Datetime_Init (Tcl_Interp* interp) {
  printf( "Initializing Package DateTime %s: ", __PACKAGEVERSION__ ); 
  int provRes = Tcl_PkgProvide(interp, "DateTime", __PACKAGEVERSION__ );
  if ( provRes == TCL_OK ) {
    puts("OK!");
    return TCL_OK;
  }
  else {
    puts("Failed!");
    return TCL_ERROR;
  }
}

Is there anything special for gnuwin32 I have to take into account? A
'extern "C"', a special compiler-flag or something like that???

Besides, for my problem it doesn't matter whether the 'tclsh' is built
wit VC++ or with gnuwin32.

Thx in advance for any hints,

--- Roland.

---
Roland Geier                    Phone: ++49 (8505) 92181          
Universitaet Passau, GER 	Fax:   ++49 (8505) 922311
Lehrstuhl Prof. Dr. Donner      geier AT forwiss DOT uni-passau DOT de	
D-94032 Passau                  http://www.uni-passau.de/~geier/


-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019