Jump to content
Excelsior Forums

oneelkruns

Members
  • Content count

    0
  • Joined

  • Last visited

    Never

Community Reputation

0 Neutral

About oneelkruns

  • Rank
    Newbie
  • Birthday 01/01/01
  1. Calling Modula-2 from C under Linux

    Just tried this before seeing your post. It gave me what I needed to get my own example working. Sweet! Thanks for the help everyone. Ron
  2. Calling Modula-2 from C under Linux

    Where might I find this example? All I see in the XDS documentation is calling C from Modula-2. Or, do I need to use XDS-C to produce C output instead of object code?
  3. I am trying to call a Modula-2 procedure from a C program under Linux (Fedora . I have this as the C code: #include <stdio.h> void helloworld_hello(); // nm says this is the procedure name int main() { helloworld_hello(); return 0; } and a simple hello world module: DEFINITION MODULE helloworld; PROCEDURE hello; END helloworld. and: IMPLEMENTATION MODULE helloworld; FROM InOut IMPORT WriteString, WriteLn; PROCEDURE hello; BEGIN WriteString('Hello world'); WriteLn; END hello; BEGIN END helloworld. First I compile the module: xc =c helloworld.def xc =c helloworld.mod which produces a .o and then: gcc qqq.c helloworld.o /usr/local/xds/lib/x86/libxds.a -lm -g which produces a.out. If I run a.out, I get a seg fault. gdb shows the backtrace as: Program received signal SIGSEGV, Segmentation fault. 0x0804f038 in IOChan_TextWrite () (gdb) bt #0 0x0804f038 in IOChan_TextWrite () #1 0x0804969e in STextIO_WriteString () #2 0x08048fdf in helloworld_hello () at helloworld.mod:7 #3 0x08048fba in main () at qqq.c:6 (gdb) So, finally, my questions: 1. C seemed happy with building the executable, what then is the problem in IOChan_TextWrite()? 2. Is this even the way to call Modula-2 from C? (I cannot call C from Modula-2 for my application, it must be from C) Any help appreciated! Ron
×