Solved

Xalan-C / Xerces-C in BCB?

Posted on 2004-10-31
407 Views
Last Modified: 2013-11-17
Hello,
I've been trying to build a BCB project that links to the Xalan-C and Xerces-C libraries provided by the Apache foundation (http://xml.apache.org/xalan-c/).
The problem is that they provide MSVC++ versions of the .lib and .dll files but so far they havent ported it to BCB.

So I realise that there are a couple of different ways to (attempt to) use MSVC libraries in BCB - these being
(a) using COFF2OMF.EXE on the .lib file to make a BCB-friendly (OMF) lib file
(b) using IMPLIB.EXE to work on the compiled DLL and extract a BCB-friendly lib file

Now I have done both of these, and both yeild the same result;
I can compile my BCB project which links to these libraries, but when it comes to linking, I get the following errors:

[Linker Error] Unresolved external 'xalanc_1_8::XalanTransformer::~XalanTransformer()' referenced from C:\PROJECTS\XSLFREE\MAINUNIT.OBJ
[Linker Error] Unresolved external 'xalanc_1_8::XalanQNameByValue::~XalanQNameByValue()' referenced from C:\PROJECTS\XSLFREE\MAINUNIT.OBJ
[Linker Error] Unresolved external 'xalanc_1_8::XSLTResultTarget::~XSLTResultTarget()' referenced from C:\PROJECTS\XSLFREE\MAINUNIT.OBJ
[Linker Error] Unresolved external 'xercesc_2_5::XMemory::operator delete(void *)' referenced from C:\PROJECTS\XSLFREE\MAINUNIT.OBJ
[Linker Error] Unresolved external 'xercesc_2_5::InputSource::~InputSource()' referenced from C:\PROJECTS\XSLFREE\MAINUNIT.OBJ
[Linker Error] Unresolved external 'xercesc_2_5::XMLUni::fgXercescDefaultLocale' referenced from C:\PROJECTS\XSLFREE\MAINUNIT.OBJ
[Linker Error] Unresolved external 'xercesc_2_5::XMLPlatformUtils::Initialize(const char * const, const char * const, xercesc_2_5::PanicHandler * const, xercesc_2_5::MemoryManager * const)' referenced from C:\PROJECTS\XSLFREE\MAINUNIT.OBJ
[Linker Error] Unresolved external 'xalanc_1_8::XalanTransformer::initialize()' referenced from C:\PROJECTS\XSLFREE\MAINUNIT.OBJ
[Linker Error] Unresolved external 'xalanc_1_8::XalanTransformer::XalanTransformer()' referenced from C:\PROJECTS\XSLFREE\MAINUNIT.OBJ
[Linker Error] Unresolved external 'xalanc_1_8::XSLTResultTarget::XSLTResultTarget(const char *)' referenced from C:\PROJECTS\XSLFREE\MAINUNIT.OBJ
[Linker Error] Unresolved external 'xalanc_1_8::XSLTInputSource::XSLTInputSource(const char *)' referenced from C:\PROJECTS\XSLFREE\MAINUNIT.OBJ
[Linker Error] Unresolved external 'xalanc_1_8::XalanTransformer::transform(const xalanc_1_8::XSLTInputSource&, const xalanc_1_8::XSLTInputSource&, const xalanc_1_8::XSLTResultTarget&)' referenced from C:\PROJECTS\XSLFREE\MAINUNIT.OBJ
[Linker Error] Unresolved external 'xalanc_1_8::XalanTransformer::terminate()' referenced from C:\PROJECTS\XSLFREE\MAINUNIT.OBJ
[Linker Error] Unresolved external 'xercesc_2_5::XMLPlatformUtils::Terminate()' referenced from C:\PROJECTS\XSLFREE\MAINUNIT.OBJ
[Linker Error] Unresolved external 'xalanc_1_8::XalanTransformer::ICUCleanUp()' referenced from C:\PROJECTS\XSLFREE\MAINUNIT.OBJ

Now I'm presuming that these issues are due to inadequacies of the LIB conversion process; I've played around with both conversion exe's and their command-line arguments but I dont seem to be gatting any where.  I'd really love to be able to build my BCB project with Xalan, so if anyone can help I'll be stoked.  For example, does anyone know of maybe a BCB port of these libs?
Cheers,
George
0
Question by:blackfrancis75
    9 Comments
     
    LVL 16

    Expert Comment

    by:George Tokas
    Did you added the libs at your project (Stupid question but many times happens )...

    gtokas.
    0
     
    LVL 5

    Author Comment

    by:blackfrancis75
    yes, I've done that - I presume they are linked correctly - Is there a way to check?
    0
     
    LVL 16

    Expert Comment

    by:George Tokas
    At View|Project Manager you can see what modules/libraries are included at your project's exe..

    gtokas.
    0
     
    LVL 5

    Author Comment

    by:blackfrancis75
    Yeah, thats how I added them originally - i thought there might be another way to check they were being linked properly, but I presume that since the error messages mention 'xalanc_1_8' and 'xercesc_2_5' that these strings are being picked up from the lib files...
    0
     
    LVL 16

    Expert Comment

    by:George Tokas
    >>Unresolved external 'xalanc_1_8::XalanTransformer::~XalanTransformer()'
    This message means that the linker can not find the specified function everywere at libs or source files... Something is made wrong...

    gtokas.
    0
     
    LVL 5

    Author Comment

    by:blackfrancis75
    where does it get the part-string 'xalanc_1_8' if not from the Lib file?  

    The only other things I did to the project (apart from adding the .lib files in Project Manager)  to integrate Xalan and Xerces was to add their include directories to the project settings.
    0
     
    LVL 9

    Accepted Solution

    by:
    Don't even bother trying. You need to recompile the whole thing under BCB. C++ code is not binary compatible between VC++ and BCB (C code is, just need to do some linker tricks).

    I'm actually working on a port (should be ready today I hope, cause I really need it for a project :) ) of the Xerces libraries. Xalan shouldn't be much different. (Same compiler & linker flags, same modifications to header files).

    Also I've ported the ICU library (which can be used with Xalan for i18n), you can find the binary libraries in here:
    http://www.idea.com.mx/icu/
    0
     
    LVL 5

    Author Comment

    by:blackfrancis75
    Thanks!  I suspected this might be the case.  I have the Xalan src, do you think it's worth me trying to port it to BCB?
    0
     
    LVL 9

    Expert Comment

    by:Cayce
    I've found out that the latest version of xerces contains a BCB port (under the projects folder). It would be a good starting point for porting Xalan.

    It's not that hard, basically add all the sources files into a DLL then fix up the dependencies and include paths. You may need to add the __declspec(dllexport) clause to all the classes and C functions you want to be exported (unless you compile everything into a lib). I usually create a macro like this:

    #if defined(__DLL_BUILD)
    #  define DECLSPEC __declspec(dllexport)
    #elif defined(__LIB_BUILD)
    #  define DECLSPEC
    #else
    #  define DECLSPEC __declspec(dllimport)
    #endif

    And then I declare all the classes like this:

    class DECLSPEC myClass { /* ... */ };

    Then just add the __DLL_BUILD or the __LIB_BUILD define in the project options (makefile) so the compiler will known when to export and when to import.

    Be sure to DISABLE the "Zero length empty base classes" option in the C++ page of project properties. I leads to a lot "FATAL INTERNAL COMPILER ERROR"'s. I don't know why this happens must be a bug of the BCB compiler.
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

     Java Android Coding Bundle

    Whether you're an Apple user or Android addict, learning to code for the Android platform is an extremely valuable, in-demand skill. It all starts with Java, the language behind the apps and games that make Android the top platform it is today.

    Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
    Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
    The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
    The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

    856 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now