[m-dev.] Problem with loading object code

Ina Cheng inch at students.cs.mu.oz.au
Mon Jan 8 17:34:15 AEDT 2001


Hi,

I'm trying to load the object code in the webserver module, and basically what
I did is just copy the `dl_test.m' sample program to the webserver but the
following is resulted when I run the webserver. The code compiles without 
any error.


*** Mercury runtime: caught segmentation violation ***
PC at signal: 1075880216 (4020a118)
address involved: 0xbf800000
This may have been caused by a stack overflow, due to unbounded recursion.
exiting from signal handler
Interrupted system call

(ps. I use telnet localhost 8080 to run the webserver)

The code is shown below:

	% L = ./libfoo.so
load_dynamic_library(L) -->
        dl__open(L, lazy, local, MaybeHandle),
        (
                { MaybeHandle = error(Msg) },
                print("dlopen failed: "), print(Msg), nl
                % XXX change print to stream__write
        ;
                        % Handle == handle(c_pointer)
                { MaybeHandle = ok(Handle) },
                        % mercury_proc(is_pred_or_func, module_name, pred_name,
                        %       arity, mode_num)
                { HelloProc = mercury_proc(predicate, unqualified("foo"),
                                "hello", 2, 0) } ,
                dl__mercury_sym(Handle, HelloProc, MaybeHello),

                % { GetSPProc = mercury_proc(predicate, unqualified("foo"),
                %               "get_stockprice", 2, 0) } ,
                % dl__mercury_sym(Handle, GetSPProc, MaybeGetStockPrice),
                (
                        { MaybeHello = error(Msg) },
                        print("dlsym failed:" ), print(Msg), nl
                ;
                        { MaybeHello = ok(HelloProc0) },
                        { HelloPred = inst_cast(HelloProc0) },
                        call(HelloPred)
                ),
                dl__close(Handle, Result),
                (
                        { Result = error(CloseMsg) },
                        print("dlclose failed: "), print(CloseMsg), nl
                ;
                        { Result = ok }
                )
        ).

The problem is with the line call(HelloPred).
If I commented out that particular line, the webserver runs without error.
Can anyone give me some advice on how to solve this error please? 


Thanks
Ina

--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list