Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!howland.reston.ans.net!ix.netcom.com!netcom.com!jazzbeau
From: jazzbeau@netcom.com (Steve Barnette)
Subject: Re: why does VWIN 2.0 work with a C dll but not with a C++ dll 
Message-ID: <jazzbeauD3M8wE.zK@netcom.com>
Organization: NETCOM On-line Communication Services (408 261-4700 guest)
X-Newsreader: TIN [version 1.2 PL1]
References: <jschnyde.191.2F36494A@inforge.unil.ch> <3h6lie$mc5@news0.cybernetics.net>
Date: Tue, 7 Feb 1995 06:05:02 GMT
Lines: 70

Forget it as far as classes are concerned. Smalltalk doesn't know how to 
deal with the vtbl and other aspects of C++ classes.  In the long run 
your better off writing C DLL's to use with Smalltalk. No name mangling, 
 vtbl's, or exception handling and etc.
If you really want to do it I would say write a C DLL that plays middle 
man to Smalltalk and your C++ DLL.

Steve  B.


kirkg (kirkg@server0.cybernetics.net) wrote:

: Can someone explain me the reason of my problem and tell me how, if
: possible, 
: I can produce a valid dll from a .cpp file (using classes and so on in
: the 
: dll). Any examples or pointers to books/articles covering this subject
: will be 
: welcomed !
: *** dll source ***************************************


: int FAR PASCAL _export myFunction(int FAR number)
: {
: // return true if number .GE. 0
:         return number >= 0 ? 1 : 0;
: }

: ------------------------------------------------------------------------
: ---
: Jean-Pierre Schnyder             e-mail :
: jean-pierre.schnyder@ulys.unil.ch
: Assistant enseignant et responsable reseau Inforge   tel :
: +41.21.692.34.10
: HEC-Inforge                                          fax :
: +41.21.692.34.05
: University of Lausanne   attn. J.-P. Schnyder  CH-1015
: Lausanne-Switzerland                     
: ========================================================================
: ====
: ========================================================================
: ====
: The problem probably is that C++ compilers mangle function
: declarations, making them differant from what the calling program is
: expecting.  The solution is simple.  You just declare the functions as
: extern 'c'.

: Note that I use Visual C++, not Borland C++.  Also, I'm doing this from
: memory so the syntax may be wrong.
: ************************  DLL header *********************
: //include if compiling under C++
: #ifdef __cpp
:    extern 'c' {
: #endif

: int FAR PASCAL _export myFunction(int FAR number);

: #ifdef __cpp
:    };
: #endif

: Kirk Gorden
: "The more you learn the less you know."
: ------------------------------------------------------------------------
: -----
-- 

_______________________________________________________________________________

FCS Systems Inc.                                             
jazzbeau@netcom.com

     Man, it's Badder than a broke dick dog!
                                Miles Davis



