RE: [xml] Dynamic Linkage And MSCC



Hello  there.

I assume something can be done to this, even without using Perl a 
special macro processor. If MSVC hasn't dropped support for this, you 
can
use "cl /E" to preprocess your source only, writing to stdout.

So you can use a file libxml.c with all the EXPORT stuff but also 
including xmlversion.h and doing all the #ifdefs.

Then

cl /E libxml2.c >libxml2.def

will generate the right .def file. Perhaps there's even a way to 
automatically execute this command from the IDE.

That would be just the right thing! The Microsoft's IDE can indeed be told
to do some pre-build processing before it actually calls the compiler. To
have the compiler generate the right .DEF file would be great, a salvation.

It is just that I don't quite follow how do you mean to get a .DEF file from
the 'cl /E' output? If we have a file called 'test.c' with the following
contents:

    #define AMACRO(p1,p2) (p1=p2++)
    unsigned long ul;
    int somefunc(int i, char c)
    {
        AMACRO(i, c);
        return i;
    }

calling 'cl /E test.c' gives us:

    test.c
    #line 1 "test.c"
    unsigned long ul;
    int somefunc(int i, char c)
    {
        (i=c++);
        return i;
    }

This switch just preprocesses a .c file, as you have said. I don't see a way
to get a valid .DEF file from that using tools which are available in this
environment (actually, the only thing surely available is the shell,
cmd.exe, and that one does not have the power to read one file and produce
another based on what it finds in the first one). What we need generated is
something like:

    ul
    somefunc

means, just a list of all non-static functions and global variables, one per
line, and that could then be appended onto a skeleton .DEF file. I don't see
a way how to get these two lines by themselves from the source file (or
object file after compiling, so the .DEF file is ready when the linker
appears on the stage). 

Am I missing something? How did you mean to get the .DEF file from an output
such as produced by 'cl /E'?

Ciao
Igor




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]