--On March 03, 2003 01:34:53 AM <[EMAIL PROTECTED]> wrote:
This question is about module programming.
When I try to compile even a simple file, gcc throws an error.
And it looks like whenever I use DX function, it cannot find the
reference of that function.

Dear Juw,

I've included (below) examples of what I have been using with Linux and DX. It has been edited to remove things that I don't think you would need. It should work, but I might have made a small error or two in the editing. Please contact me if you have problems.

The makefile creates a shared object to which DX links as it runs. It learns about the shared object by reading the mdf file; therefore, you must run it like this:

  dx -mdf mymodule.mdf

If your current directory does not contain the files example.mdf and mymodule.so, you must expand the file name (above and in the sample mdf file below) to include an appropriate path.

Cheers!
Kent
- - -
Kent Eschenberg   [EMAIL PROTECTED]   (412)268-6829
Scientific Visualization Specialist
Pittsburgh Supercomputing Center, CMU, Pittsburgh, PA

There are only 10 types of people in this world:
Those who understand binary, and those who don't.

=====
Example of file "mymodule.mdf"
=====
MODULE mymodule
CATEGORY Import and Export
DESCRIPTION any comment
LOADABLE mymodule.so
INPUT options; string; (none); a sample of a module input
OUTPUT metadata; string; a sample of a module output


=====
Example of file "makefile"
=====
# Simple makefile for creating a DX module
#   For version 4.1; don't know if works with other versions
# mymodule
#    A dummy name for the new module
#    mymodule.c: the source
#    mymodule.mdf: the DX mdf file
# modules2dx
#    A subroutine that tells DX about the new module
#    Automatically generated
# Note: not all the included libraries may be needed
# Note: include additional libraries as needed for your module

DXBASE = /usr/local/dx

mymodule.so: mymodule.o modules2dx.o
        cc -o mymodule.so -shared -e DXEntry mymodule.o modules2dx.o\
        -L$(DXBASE)/lib_linux -L/usr/X11R6/lib -lDX -lGL -ll -lX11 -lm -lm -lc

mymodule.o: mymodule.c
        cc -c -I/$(DXBASE)/include mymodule.c

modules2dx.o: modules2dx.c
        cc -c -I/$(DXBASE)/include modules2dx.c

modules2dx.c: mymodule.mdf
        $(DXBASE)/bin/mdf2c -m mymodule.mdf > modules2dx.c

Reply via email to