Advanced Search
Mail us
Home    Manuel    Links    Faq    Submit a tcl/tk Reference    Contact Us

    Some examples tcl/tk codes     Man of Bwidget     Man of blt     mkwidget screenshots     TkOgl     Video Demo real.


  C++ and DLLs
 
 If you write your Tcl extensions in C++, you`ll likely need to use the extern "C" { }; statement in C++ to use your functions in Tcl.
This is due to the user of "name mangling" in most C++ compilers. 

-Eric Foster-Johnson 

This especially true for your exported Init routine for the extension. 

#ifdef __cplusplus
extern "C"
#endif
EXTERN int Foo_Init (Tcl_Interp *interp) {
  ...
  return TCL_OK;
};

Where "Foo" is the DLL`s name. If your extension is called calcBIG.dll, use "Calcbig_Init" for the function`s name. Notice that the
first letter is always capitalized and all following characters are lower case. 

-David Gravereaux