A Flash Developer Resource Site

Results 1 to 16 of 16

Thread: Flash SDK with Borland CBuilder?

  1. #1
    Junior Member
    Join Date
    Feb 2001
    Posts
    13
    I'm a Delphi (Pascal) programmer, and it's been many years since I programmed in C++. However, I now want to build a simple application using the Flash File Format SDK. Since that's only available in C++ source form, I'm trying to use my available C++ compiler (Borland CBuilder 3.0) to build that application. I'm running into trouble, which I *assume* is because the Flash SDK is built for Microsoft Visual C++.

    Has anyone built an application in Borland C++ using the Flash File Format SDK? If so, can you give me a hint about how you overcame these compatibility problems?

    I'm sure I'll eventually figure it out myself, but it's very painful. :-) What I have right now is a syntax error on the template definition for the "max" function in stdlib.h. I'm not sure what the Macromedia stuff is doing to create a conflict. I get this error as soon as I incorporate any of the basic low-level Flash modules (other than FObj.cpp or FSwfStream.cpp) into my project.

    I can change the reported error by manipulating the compatibility settings (e.g., use MFC-compatibility mode), but there's still an error, and I don't think those modes are correct, anyway.

    Any pointers you can provide would be much appreciated.

    Rudy

  2. #2
    Senior Member
    Join Date
    Jul 2000
    Posts
    503
    I already responded to your post at the Macromedia NG, but the same applies here. Post follow-up to either location...but for quickest response, post here.

    --Jesse

  3. #3
    Junior Member
    Join Date
    Feb 2001
    Posts
    13

    BCB 5 works fine

    I'm using version 5 of C++Builder, and it works fine.

    I have 'MFC Compatibility' turned on (I'm pretty sure you'll need it on, and I'm not aware of any problems with that), I can't see anything else unusual in my project options.

    FWIW my stdlib.h max() definition is

    template <class _T> inline const _T _FAR &max( const _T _FAR &__t1, const _T _FAR &__t2 )
    {
    if (__t1 > __t2)
    return __t1;
    else
    return __t2;
    }

    what's yours? NB macromedia.h will define in if it isn't already defined.

  4. #4
    Senior Member
    Join Date
    Jul 2000
    Posts
    503
    What is the exact error message?

    --Jesse

  5. #5
    Junior Member
    Join Date
    Feb 2001
    Posts
    13
    Thanks very much to the several of you who gave
    encouragement. I'm glad to hear some of you have
    successfully used the Flash File SDK with Borland CBuilder,
    albeit version 5.0.

    I seem to have eliminated the conflicts involving the
    min() and max() functions. However, I eliminated them by
    commenting out the macroprocessor definitions in
    "macromedia.h". I didn't seem to be able to eliminate the
    problems otherwise. Also, this only fixes the problem if
    I do *not* use MFC Compatibility mode. If I do use that
    mode, I get syntax errors in the CBuilder library's list.cpp
    init() function ("Could not find a match for
    std::max(unsigned int, unsigned int)."). If I'm taking the
    wrong approach here to the problems with the conflicting
    min/max definitions, I'd appreciate being steered back on
    course. :-)

    I've now been studying templates (new to me, as my C++
    programming was quite awhile back), and I've been studying
    list.cpp, because these two areas are the focus of the next
    problem. I'm getting a compiler error which I think is due
    to an attempt to iterate across a list that's built using a
    structure definition, rather than a class. I've seen
    documentation with my current compiler that indicates that
    templates can use structs, so I'm assuming the problem is
    not that my Borland CBuilder 3.0 is too old. I've given the
    details below. If anyone can shed further light on the
    problem and/or its solution, it would be most appreciated.
    I'm happy to make modifications to the Flash SDK files if
    necessary, but I don't want to start ripping them up without
    a bit better idea what I'm doing. :-)

    Rudy

    From Flash File SDK FDTText.cpp:

    Earlier in file, the following is compiled without syntax
    errors. Here, FTextRecord is a class.

    std::list<FTextRecord*>::iterator cursor;
    for ( cursor = textRecords.begin(); cursor != textRecords.end(); cursor++)
    {
    (*cursor)->WriteToSWFStream( &body, nCodeBits, nAdvanceBits );
    }

    Later in the file, here's where the error occurs. In this
    case, GlyphEntry is a class.

    U32 FTextGlyphRecord::MinAdvanceBits()
    {
    std::list<GlyphEntry>::iterator it;
    int maxBit = 0;
    for ( it = glyphEntries.begin(); it != glyphEntries.end(); ++it )
    {
    maxBit = max( FSWFStream::MinBits( it->advance, 1 ), (U32)maxBit );
    ***** Error: "Pointer to structure required on left side of -> or ->*." *****
    ***** When the error is reported, the cursor is placed after "it" of "it->advance" ******
    }
    return maxBit;
    }

    From FDTText.h:
    class FGlyphEntry;
    struct GlyphEntry
    {
    U16 code;
    U16 advance;
    };
    std::list<GlyphEntry> glyphEntries;

  6. #6
    Senior Member
    Join Date
    Jul 2000
    Posts
    503
    This error is the same as with the GNU compiles...basically, VC++ iterators contain different functionality.

    Change the line to:

    maxBit = max( FSWFStream::MinBits( (*it).advance, 1 ), (U32)maxBit );

    To solve your min/max problem, here is a simple solution...change all calls to min and max in the SDK to flashmin and flashmax respectively...then change the definitions to use these names and you are good to go.

    --Jesse

  7. #7
    Junior Member
    Join Date
    Feb 2001
    Posts
    13
    Jesse,

    >>Change the line to:
    >>maxBit = max( FSWFStream::MinBits( (*it).advance, 1 ),(U32)maxBit );

    Thanks very much. I assume that I need to make this change only to the lines that turn up syntax errors? That is, I'm assuming that those lines that pass the syntax checker can be expected to have the same semantics under BC++ as VC++. Is that your guess?

    >>To solve your min/max problem, here is a simple solution...change all calls to min and max in the SDK to flashmin and flashmax respectively...then change the definitions to use these names and you are good to go.

    Good idea, thanks. Should have thought of it myself. :-)

    Rudy

  8. #8
    Senior Member
    Join Date
    Jul 2000
    Posts
    503
    yep. only the lines that give errors should need the change.

    --Jesse

  9. #9
    Junior Member
    Join Date
    Feb 2001
    Posts
    13
    Jesse,

    To my very pleasant surprise, that was all it took. Most of these exercises turn up one layer of problems after another, but I've just built a (not very impressive, but exciting nonetheless) sample SWF file (their HFExampleCircle).

    Onward and upward! :-)

    Thanks again for your help.

    Rudy

  10. #10
    Junior Member
    Join Date
    Jan 2001
    Posts
    5
    Hi JAEzell, Rudy & core.

    So the SDK can be compiled using the free Borland C++ compiler?
    This is very good news if so, could you tell me how?

    I can't get past the fact that the VCTOBPR utility (which converts Microsoft Visual C++ 5.0 and 6.0 project .DSP and workspace .DSW files to their equivalent Borland C++Builder files) is not included with the free Borland C++ compiler.

    Thanks
    WR



  11. #11
    Junior Member
    Join Date
    Feb 2001
    Posts
    13
    Originally posted by WrecklessRat
    Hi JAEzell, Rudy & core.

    So the SDK can be compiled using the free Borland C++ compiler?
    This is very good news if so, could you tell me how?
    Yes, I used the free BC++ 3.0 compiler that came with Delphi 5. I didn't even try to use the makefile. I just built a new project and included all the source files for the Flash SDK. I then added a button to the form and put the sample code for building a circle SWF file in the OnClick event.

    In the process, I did encounter a problem or two, but you'll find their solutions earlier in this thread. It worked fine.

    Unfortunately, it turns out that I really don't want to use the MacroMedia SDK. I think that's discussed in one or two other threads here (you can look for my name as the poster of the original question). And I ran into trouble trying to compile the OpenSWF SDK using this version of Borland C. My management is now considering my request for VC++. If I get it, though, I'm likely to use it to wrap the OpenSwf SDK in a DLL, so I can do my actual development in Delphi. We'll see.

    Rudy

  12. #12
    Senior Member
    Join Date
    Jul 2000
    Posts
    503

    Bukoo

    Bukoo is going to be redeveloped using the SWFSource SDK. You might want to get in touch with the author of Bukoo and talk with him, because bukoo is basically that. It is a set of COM objects that you could use with Delphi, VB, ASP, etc. If he is keeping the same methods, etc. you might be able to begin developement with Bukoo right now and then when the rewrite is complete, you would simply have to upgrade and maybe make some minor changes.

    --Jesse

  13. #13
    Junior Member
    Join Date
    Jan 2001
    Posts
    5
    Hey Rudy thanks for the quick reply.
    Glad to hear it is possible and I will try your suggested method.

    BTW re: your other post "Can HTML/JavaScript events affect SWF?"
    If you've not checked the flashcoder list I'd recommend it. You can search the archives at:
    http://chattyfig.figleaf.com/search.html
    I am pretty sure this has been discussed there.

    Thanks
    WR

  14. #14
    Junior Member
    Join Date
    Feb 2001
    Posts
    13

    Re: Bukoo

    Originally posted by JAEzell
    Bukoo is going to be redeveloped using the SWFSource SDK...
    --Jesse
    OK, thanks for mentioning that. I looked at Bukoo, of course, because I thought it might be useable from Delphi (I think you even mentioned it). The Bukoo website lists three tutorials which I would need to make real headway, but the links are dead. I sent a message to the author, but got no reply. I then found a message in this forum dated last September asking about the same thing, and getting no reply. I concluded Bukoo was dead.

    How would I go about getting enough information to actually give it a try?

    Rudy

  15. #15
    Junior Member
    Join Date
    Jan 2001
    Posts
    5
    SDK woes...
    Having difficulty using the free Borland C++ compiler (Standard version, just DOS, no GUI)

    Tried using Bloodshed's DevC++ which is really nice (and free) but still having problems.

    I realise it must be tough for Macromedia to support all compilers/IDEs and all.
    But if they were going to choose just one as the default I wish they would have picked a free one :o)

    I will get there in the end though.

    WR

  16. #16
    Senior Member
    Join Date
    Jul 2000
    Posts
    503

    DevShed

    That uses the Win32 compile of GCC, right? Your problems are probably pretty simple ones related to nonstandard STL code in the MM library...try changing "*pointer." to "pointer->" and stuff like that.

    --Jesse

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center