Subject: Loading dll dynamically into Tcl-Interpreter???
From: [email-masked] (Roland Geier)

3 Jul 1997 07:31:17 -0700
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Original-To: [email-masked]
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: [email-masked]

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      [email-masked]	
D-94032 Passau                  http://www.uni-passau.de/~geier/

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".