home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!usc!elroy.jpl.nasa.gov!swrinde!gatech!purdue!mentor.cc.purdue.edu!noose.ecn.purdue.edu!samsung!balrog!ctron.com!kurr
- From: kurr@ctron.com (Ron Kurr)
- Newsgroups: comp.lang.c++
- Subject: Linking C++ code into a C program
- Message-ID: <5062@balrog.ctron.com>
- Date: 15 Sep 92 21:47:41 GMT
- Sender: root@balrog.ctron.com
- Reply-To: kurr@ctron.com
- Organization: Cabletron Systems, Inc.
- Lines: 24
-
- Ron D. Kurr kurr@ctron.com
-
- I have C++ code that I would like to reuse in a C environment. Once I
- provide the C interface, I need to link everything together. C does not
- have the facilities to handle static C++ objects. In a C++ environment,
- patch/munch take care of this problem. How can I reuse C++ code in a C
- environment?
-
- One solution is to use Dynamic Link Libraries. I can give them a
- C++ executable that will load a user defined object file at runtime.
- The static objects are already set up and the user can add C code. The
- problem is that not all platforms support DLL (Ultrix).
-
- A second solution is to provide a translator process. The C library
- talks to a seperate C++ process. This process translates calls from C
- into C++. This method solves the patch/munch problem but, obviously,
- takes a performance hit.
-
- I would appreciate any other ideas. I would like a solution that works
- on Sun OS4.1, SGI, Solaris, Ultrix and RS600.
-
- Thanks,
-
- Ron
-