Thread View: comp.std.c++
2 messages
2 total messages
Started by Roland Schwan
Wed, 26 Jun 1991 14:18
Calling c++ from a c program
Author: Roland Schwan
Date: Wed, 26 Jun 1991 14:18
Date: Wed, 26 Jun 1991 14:18
37 lines
916 bytes
916 bytes
Hello netters!
Is there any chance to call a C++- method from a c-program?
Such as :
...c-file:
main()
{....
..
something();
....
}
...c++-file:
....
void something();
{
cout << "Output of c++ \n";
}
When I tried this, all I got was a core dumped.
Any ideas?
Roland.
____________________________________________________
Roland Schwan
rs@heike.informatik.uni-dortmund.de
It's better to burn out, than to fade away! (Kurgan)
____________________________________________________
Re: Calling c++ from a c program
Author: Ken Raeburn
Date: Thu, 27 Jun 1991 01:14
Date: Thu, 27 Jun 1991 01:14
19 lines
1140 bytes
1140 bytes
In article <3575@laura.UUCP> rs@heike.informatik.uni-dortmund.de (Roland Schwan) writes:
...c-file:
main()
{....
..
something();
....
}
The problem here is that some C++ implementations (UNIX ones at least
-- I haven't used others, and you didn't say what you were using)
require that `main' be compiled as C++ code, in order for constructors
for static objects to be run.
If you can't move this `main' routine into a C++ file, rename it to
`main2' or something, and add a new `main' routine in a C++ file which
simply calls `main2'.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads