C functions calling C++ functions on Solaris

C functions calling C++ functions on Solaris

Post by David Harm » Mon, 30 Mar 1998 04:00:00

>we can call the C function (and verified that name stays C style).
>also inside the C function,
>we CAN also call another function that is written in C++
>(thereby using the C function as a wrapper),
>however if in the C++ function, we use anything that uses classes,
>it would get us the "Insufficient Memory" error displayed.
>(btw, we are using the Sun Solaris compiler, if that matters.)

Here is a guess: perhaps you have to make sure that main() is a C++
function, so that the C++ libraries are all initialized correctly.

1. how to know the instruction address of calling function within called function?

Suppose function A call B, are there any ways to know the address of last instruction in A just
before calling B from within B? I would like to do some profiling by substituting B by a routine with record
the time spent on B. I also would like to know the time spent on B in different locations of A
where B is called. If I can know the address of last instruction in A just before calling B, from
debuging info of the excutables, I can find its source code address, therefore know the
time spent on B in differnet locations of A.

I don't want to make any changes to A. "-pg" compiler option for profiling is of no use either,
because there is no source code for B, and there is no object code for B with profiling codes in,
so you can't know the total time spent on B, but only the self time spent on B.

Thanks very much.

Kingston, Ontario K7L 3N6        Tel: (613) 545-2723 (o)
Canada                           Fax: (613) 545-6463
Home address:
58 1/2 Chatham St.               Tel: (613) 547-1353 (h)
Kingston, ON K7K 4G8

2. Do you think we're IDIOTS? (WAS: $$$$$MAKE BIG CASH$$$$$)

3. Browser calls CGI C function which sets an env var and call a c function crashes

4. Unable to reset scsi 0

5. Call function within a function

6. Highway prodject

7. Tree of Functions calling Functions etc.

8. Catastrophe -> fsch damaged totaly the filesystem

9. Main function calling another main function

10. C++ class member function as a thread function.

11. why distinguish C++ function from C function?

12. Non-__init functions calling __init functions

13. Name of the function/script that called the actual function?