home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / cplus / 13713 < prev    next >
Encoding:
Internet Message Format  |  1992-09-15  |  1.3 KB

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