AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.


#Power
#Power
#Operatingsystems
#Servers
 View Only
Expand all | Collapse all

Application crahses when pointer to memory is returned from a shared librar

  • 1.  Application crahses when pointer to memory is returned from a shared librar

    Posted 12/19/09 04:21 AM

    Originally posted by: vinodh_nair


    Hi,

    I have created two shared libraries (written in C) in AIX53. One of these shared libraries named util.so has defined a number of general utility functions (like alloc_memory() ). alloc_memory() creates and initializes memory and return a pointer to the called function.

    The other shared library makes a call to alloc_memory() defined in util.so. But when the function returns, the application crashes saying "illegal instruction". The crash occurs when the "return" statement is executed in alloc_memory().

    What could be the cause of the above error? Is it because I am returnign a pointer to memory allocated in one shared library to another shared library? How can I solve this issue? Is there any equivalent of '__delspec dllexport" in AIX? Can I solve this by usign any linker/compile options?
    #AIX-Forum


  • 2.  Re: Application crahses when pointer to memory is returned from a shared librar

    Posted 12/19/09 12:46 PM

    Originally posted by: jklotz


    Hello,

    are you able to reproduce this behaviour with a testcase, and if yes can you provide the statements (linker options, ...) you use to create the shared objects and main executable ?

    No reason it should not work as the libc malloc() comme from a shared object :)

    How do you know the error comes from the return function ? did you use a debugger ? is there not a symbol just before or just after the return (in the calling module), and referring to a function or variable coming from another shared object ?
    #AIX-Forum