From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,4bac94c463f961a6 X-Google-Attributes: gidfee84,public From: spratte@odette.cxo.dec.com (Michael Spratte) Subject: Re: How can you call C++ code from C code, using "DEC C" & "DEC C++ V1.3B" Date: 1995/08/10 Message-ID: <40dnel$bje@nntpd2.cxo.dec.com>#1/1 X-Deja-AN: 107907783 distribution: world references: <40br6e$knf@merlin.resmel.bhp.com.au> organization: Digital Equipment Corporation reply-to: spratte@odette.cxo.dec.com (Michael Spratte) newsgroups: comp.unix.osf.osf1 In article <40br6e$knf@merlin.resmel.bhp.com.au>, Joe Spanicek,BHP-Research PKL,, writes: |>Hi, |> |>I have OSF/1 V3.0 using "DEC C" & "DEC C++ V1.3B". The problem I am having is |>calling a archive compiled with 'C++' from with C code witch is compiled with |>'C'. |> |>The problem lies with linking the archive library to the generated C code. The |>C++ compiler produces object code with a 'name' reference to functions |>differently than does the C compiler. So in the end the linker can not make |>the connection between the functions. |> |>Could anyone give pointers on how to get around this, I am fluent in C but just |>started in C++. I am trying to use a library written in C++ within software |>written only in C. |> Declare swapme in function.cc as `extern "C"': #include extern "C" void // <<---------------------------------------------- swapme(int *p, int *q) { printf("in swapme: %d %d\n", *p, *q); int t = *p; *p = *q; *q = t; } Michael Spratte DSNlink Engineering Digital Equipment Corporation Colorado Springs, Colorado