Free C++ Compilers and KX DSP

Discussion in 'Effects and the DSP' started by ROBSCIX, Sep 16, 2005.

  1. ROBSCIX

    ROBSCIX New Member

    Joined:
    Mar 28, 2004
    Messages:
    1,732
    Likes Received:
    4
    Trophy Points:
    0
    This has been a source of much frustration for me, so I would like to hear everybody's thought. I have asked Eugene to participate also, as I was informed this subject is unknown to most user as it has never been attempted. So here's the thread and let's hear the ideas please.:)
     
  2. Eugene Gavrilov

    Eugene Gavrilov kX Project Lead Programmer and Coordinator

    Joined:
    Dec 7, 2002
    Messages:
    3,146
    Likes Received:
    9
    Trophy Points:
    48
    so, there are at least two possibilities: either use a freeware version of M$ visual C compiler (can be downloaded for free) or mingw32 or any similar gnu/watcom/whatever
    --
    REQUIREMENTS:
    you will need a set of windows headers (windows.h etc..) -- not bundled with freeware msvc(!)
    standard ansi headers (usually bundled with the compiler)
    a compiler, a linker
    a make utility or similar tool
    MFC 4.2 headers and libraries (debug ones! - mfc42d.lib, mfcs42d.lib etc..)
    kX SDK
    --
    now go to \fx_demo folder:
    here's a brief description of files
    --
    da_demo.cpp is generated by kX DSP (don't forget to generate new GUID -- and add your copyright notice) -- you may wish to rename it to da_{your fx name}.cpp
    debug.cpp -- leave as is
    *.dsp/*.dsw - leave it, since you don't use MS VC6
    fxlib.rc - edit it to reflect your copyright / name
    simple.cpp: edit if you change file names (e.g. 'demo' -> 'my_effect')
    demo.cpp: plugin GUI -- will definitely need to be updated :)
    ---
    you will need to define -D"_MBCS" -D"_AFXDLL" -D"_USRDLL" -D"_WINDLL"
    also, if your compiler supports pre-compiled headers, add 'stdafx.h' (e.g. /YX"stdafx.h" optoin)
    add '../h' as your include path (e.g. '-I..\h')
    add three additional libraries: ../lib/kxapi.lib, ../lib/kxgui.lib, ../lib/kxmixer.lib
    (and add '../lib' as your default library path)
    there's a simple makefile included, which, however, might be outdated and will only work for MS-based compilers
    --
    add the following files to your own makefile:
    debug.cpp demo.cpp simple.cpp stdafx.cpp
    do NOT add da_demo.cpp!
    set output type as 'windows DLL'
    add fxlib.rc to your project (or use any resource compiler you have to generated .res file)
    add MFC42 headers and libraries to your INCLUDE and LIB environment variables
    compile and link the .dll
    rename it to .kxl and register (right click - register)
    ---
    that's it!

    E.
     
  3. Russ

    Russ Well-Known Member

    Joined:
    Jan 17, 2005
    Messages:
    5,722
    Likes Received:
    13
    Trophy Points:
    48
    Eugene, what is your take on the issue of MFC compatibility with the compiler? My understanding is that MFC (particulairly older versions such as MFC 4.2), are not fully ISO compliant and as such, freeware compilers that do not specifically claim MFC support, will have problems using the MFC headers/libs (even the newer MS compilers (which claim to be more ISO compliant) have issues with some of the MFC 4.2 headers). In trying to help ROBSCIX, I did some brief searching of the DEV C++ forum, and found many threads indicating that it (DEV C++/mingw32) was not compatible with MFC (and have seen simialr info regarding other freeware compilers).

    I think the best bet (in using a free compiler) is to use the free compiler from the Visual C++ Toolkit 2003, as it claims to be the same compiler (a command line version) as that which is included with VC++ .NET 2003. However, in my VC++ .NET 2003 testing (using MFC 4.2), I have found that afxtempl.h needed to be modified, and math.h from VC++ 6 needed to be used to get it to compile, otherwise it worked (math.h was needed due to issues with plgmath.h, alternativley plgmath.h could be modified). I imagine since the toolkit uses the same compiler, that the same modifications would be needed to get it to work.

    -Russ
     
  4. radiocolonel.it

    radiocolonel.it New Member

    Joined:
    Jan 16, 2005
    Messages:
    192
    Likes Received:
    0
    Trophy Points:
    0
  5. ROBSCIX

    ROBSCIX New Member

    Joined:
    Mar 28, 2004
    Messages:
    1,732
    Likes Received:
    4
    Trophy Points:
    0
    All this thread is trying to accomplish is a definative source for information on this subject. I talked to quite a few people regarding this info and I was sent in circles many times. So I went to the horses mouth. Wether using DEV C++ or not is irrelavent..it is an example of a freeware compiler. As long as you have the proper headers and lib's to link to I guess it's compatible-that's from Eugene.
     
  6. Max M.

    Max M. h/h member-shmember

    Joined:
    Dec 7, 2002
    Messages:
    2,690
    Likes Received:
    9
    Trophy Points:
    63
    ROBSCIX

    >Eugene, what is your take on the issue of MFC compatibility with the compiler?

    Don't forget: kX started in 2001-2002... that time we have had to get something working as sooner as possible (and not super-puper portable, and not the center of someone's digital universe) - and we decided to use MFC for user-intefaces. It's not a big problem to rewrite everything w/o MFC - but for now it makes no sense to waste a year just for ghostly possibility of wider uses of different compilers.

    > As long as you have the proper headers and lib's to link to I guess it's compatible-that's from Eugene.

    Exactly, i see no problem using mingw for building kX mixer plugins as soon as you have required headers and libs (win32/mfc)
    and, btw - stop calling Dev-C++ _compiler_ - it is not - it is IDE.. its compiler is gcc (kinda "mingw edition" ;) - wrong definitions add unnecessary-confusing-mix-ups.

    And as other people already said to you before: to get started with kX you can write your plugins without C++ at all.. (yes using Dane) - more over you still have to write your DSP code using Dane (“Dane” as a language - not kX Editor) whether or not you’re plannig your plugin to have user-interface written in C++... so if you have no DSP code - you have no plugin - (whatever your C++ compiler and your C++ experience are)...
    - i hope you've got my idea – this (“compiler war”) is just wrong starting point.

    ---
    (just for case - if you are really interested in "programming DSP algorithms with C/C++" - consider starting your training with VST/DirectShow plug-ins - not kX)
     
    Last edited: Sep 17, 2005
  7. ROBSCIX

    ROBSCIX New Member

    Joined:
    Mar 28, 2004
    Messages:
    1,732
    Likes Received:
    4
    Trophy Points:
    0
    I understand perfectly what Eugene said. But if you feel the need to repeat it to me ok. Yes I know IDE, GCC is the compiler..etc..thanks for the terminology lesson...I guess I should know better than to shorten a term in a forum:D ...AS for the Dane info, Yes I know that also. Thx though. Maybe this thread could be a good source for people with the same questions...:) That was my idea.
     
    Last edited: Sep 17, 2005
  8. Max M.

    Max M. h/h member-shmember

    Joined:
    Dec 7, 2002
    Messages:
    2,690
    Likes Received:
    9
    Trophy Points:
    63
    >aybe this thread could be a good source for people with the same questions...

    Exactly.
    (sorry, i know - sometimes i sound too hard... yep... i decided to put that here just for some case... - or other people entering this thread may start to think that "kX is a secret agent of MS, it forces people to buy old and useless VC6 and does not really like others to contribute, abases free compilers (like "Dev C++" one) and so on..." ;)
     
    Last edited: Sep 18, 2005
  9. ROBSCIX

    ROBSCIX New Member

    Joined:
    Mar 28, 2004
    Messages:
    1,732
    Likes Received:
    4
    Trophy Points:
    0
    hmm, I just wanted a straight answer if it was an option or not. See I had alot of information regarding that question. Yes, No, Maybe but linking is required, Yes but never been done in this fashion. You can get a free Ms compiler-but it doesn't contain the MFC, you can get a different version from MS but you cannot use it for MFC type projects?..now you see where all the frustration comes fom when all I wanted to do was contribute and possibly develop my own ideas...:duh: oh well.
     
  10. Russ

    Russ Well-Known Member

    Joined:
    Jan 17, 2005
    Messages:
    5,722
    Likes Received:
    13
    Trophy Points:
    48
    Well it is a catch 22... Most people that have MFC, have VC++, so they do not need to try and use it with other compilers. MFC compatibilty with other compilers has nothing at all to do with kX, and although you think that some of us should know for sure what will work, and what won't, that is simply not the case. We can only tell you what we think based on our individual experiances, we cannot say anything for absolute certainty, regarding any 3rd party software, without having done it successfully ourselves (or at least having some reliable source of information to refer to).

    The bottom line is that MFC (being a commercial library) is not likely to be included with any freely available software, and if it was, it is also likely that it would be under a very limited license (i.e. as in an introductory version of VC++), that would most likley prevent you from being able to publish anything that you created using it (for anything other than demonstration purposes).

    The free stuff that is available from Microsoft (as well as the commercial software), specifically states what it can be used for (i.e. licensing info), and what is included with the software. Any confusion regarding MS software can be cleared up by refering to the documentation (and FAQ's) for that software.

    The same things goes for 3rd party compilers, etc. The developers of that software would be the best source of information regarding compatibility with specific libraries such as MFC.

    We can only offer information based on our experiances, and/or refer you to information that we may find about the issue. Beyond that it is just an educated case, which may not always be correct ("should work" does not mean "will work").

    When I give information that I cannot be sure about, I try to indicate that in my response, and I try to give the reasons behind my thinking that way, or the source of the information, that lead me to that conclusion, etc (see my previous post). Beyond that it is up to you to follow up on that info (i.e. if you think it is not correct).
     
    Last edited: Sep 18, 2005
  11. Maddogg6

    Maddogg6 Tail Razer

    Joined:
    Jun 21, 2005
    Messages:
    4,027
    Likes Received:
    26
    Trophy Points:
    0
    I spied this - LCC - then, theres this post in their forums that -
    Assuming KX requires the MFC library for calling COM objects - (??)

    Offers a work around. Both the Library named in this post:
    http://www.q-software-solutions.de/forum/viewtopic.php?t=1927&highlight=mfc
    and LCC are freeware (or free for private use) - comments?

    I guess Im asking if the MFC libs are needed ONLY to call COM objects?
    Not that I understand completely, but Im just curious.

    edit: nevermind - I misunderstood - theyre just accomplishing something wothout the need of MFC - like KX should - arg... lol j/k.
     
    Last edited: Dec 7, 2005
  12. Lex Nahumury

    Lex Nahumury DH Senior Member

    Joined:
    Jan 5, 2003
    Messages:
    1,944
    Likes Received:
    6
    Trophy Points:
    0
    kX's MFC dependancy is not the biggest problem.
    It is absolutly possible to write kX plugins without using MFC
    as long as you don't use/link to kxgui.lib.
    Of course you'll have to provide your own gui framework (plain win32 api works fine for me),
    and write some alternative code for preset handling and a few other things.
    Providing your own GUI framework sounds like a big turnoff,
    but not using kxgui certainly has it's advantages .

    The real problem however is that you can not link the import library kxapi.lib
    with any other compiler then the one who produced it, namely MSVC's compiler.
    So forget about any Free non-MS compiler. 99% that it won't work!!
    If someone has achieved this (which I doubt) without having kxapi.dll source code, then plz speak up!

    The only way to write kX plugins 'for free',
    is by using a free MS-compiler (.NET/VS2005 Express/MS Platform SDK)
    and provide your own GUI framework.


    /LeMury
     
    Last edited: Dec 29, 2005
  13. Max M.

    Max M. h/h member-shmember

    Joined:
    Dec 7, 2002
    Messages:
    2,690
    Likes Received:
    9
    Trophy Points:
    63
    >If someone has achieved this (which I doubt) without having kxapi.dll source code, then plz speak up!

    I have. (google for 'coff2omf' and 'implib')
     
  14. Lex Nahumury

    Lex Nahumury DH Senior Member

    Joined:
    Jan 5, 2003
    Messages:
    1,944
    Likes Received:
    6
    Trophy Points:
    0
    >>I have. (google for 'coff2omf' and 'implib')
    I hoped you did.
    Hmm,... yes, I've tried that, but no success. I will try it again and report back.
     
  15. Maddogg6

    Maddogg6 Tail Razer

    Joined:
    Jun 21, 2005
    Messages:
    4,027
    Likes Received:
    26
    Trophy Points:
    0
    Ahhh. ok, now its making more sense.

    Thanks for the info LeMury.

    I guess Im a bit off from making anything usefull.... but I am looking for 'if its in my realm of possibilities' to even start heavy 'study' on this subject.

    Im trying to learn, but it seems like the beginner tutorials (On C/C++) are either, too simple (and boring) OR more intersting stuff is too complex and not very well commented, or is using terms assumed is understood already... I have a hard time finding stuff thats more complex yet well commented code examples.

    I have a particular hard time grasping techniques NOT opcodes/commands per se.

    A good example is a simple sort routine... I understand the various string manipulations, I understand the need for sorting - but no matter how much I look an an example in C - I dont understand the programming logic to it by examining code. - So I've been looking at BASIC implementaions to try to understand these types of techniques.

    Any good site you can recommend (on C/C++) for a guy like me?

    Any insight would be greatly appreciated.

    and Thanks again....
     
  16. Russ

    Russ Well-Known Member

    Joined:
    Jan 17, 2005
    Messages:
    5,722
    Likes Received:
    13
    Trophy Points:
    48
    I think the problems with some of the beginner tutotrials is that they are for C/C++ itself, and thus they really do not include any GUI stuff (other than the basic console), and because of this, much of the material covered is a bit boring. It does however include the basic information about the language that you need to understand (you really want to have a good understanding of classes and pointers). It gets more interesting when you start working with GUI's, but the problem with that is that you are learning more about a specific library than you are about the language itself (and is the reason why it is usually not covered on the basic C/C++ tutorials). If you are looking for stuff that can be built using basically any compiler, then I would start with Windows Platform SDK stuff. This will allow you to design Windows programs, and the GUI lib is basically part of the OS itself so you do need need any extra libs. In this case you are learning more about programming Windows itself, then you are about the language, but it is a lot more interesting. The key is to start building something/anything. Once you start actually doing it, you will find that you will start to understand it a lot more (kind of like using kX).

    The FunctionX website provides many tutorials for a wide variety of topics including programming languages like C++.
    The Forger's Win32 API Programming tutorial is pretty good for someone getting starting with Windows programming using the Platform SDK and C++.
    The CodeGuru forums are a great place to find answers to some questions you might have. Also the CodeGuru and CodeProject websites include a bunch of example source code for various things.

    One you start working with it, and understand the terminolgy, etc, then you will be able to locate the information you are looking for yourself. When trying to understand something that maybe a little difficult, it helps immensly if you have a real interest in the topic, and until you actually have a need for some of the things covered in the tuturials you are reading (which you will not have until you actually start programming), maybe that interest does not exist.
     
  17. Maddogg6

    Maddogg6 Tail Razer

    Joined:
    Jun 21, 2005
    Messages:
    4,027
    Likes Received:
    26
    Trophy Points:
    0
    This is prolly somewhat true... as the tutorials I do see - Source code that is commented well, are on a subject - or maybe is of little use to me personally.
    So YES - for me programming is not 'fun' per se, more of a means to an end.

    For instance - I picked up PHP pretty quick (faster than C anyway, Im still NOT a programmer) - because I was able to find example code that is similar to my needs. I dont find this with C/C++ - where working source examples arent usually very well documented.

    Im very much that way - Its like pulling teeth for me to learn stuff thats NON-APPLICAPLE to me. (Like Algebra - as soon as it was applied to electronics, real world 'association' kicks in and then it made clear sense to me, the abstract isnt very friendly to me)

    I figured with KX - I do have this interest - BUT, most of the info is using an old VC (I have an old NFR VC 2003 now, btw). AND not to mention the hidden stuff, PHP - EVERY thing is exposed and PHP.NET has an EXCELENT reference with A TON of examples for each command.

    And yes, no GUI makes it more difficult to get 'instant' gratification from these efforts.

    Thanks for the great info Russ.
     
  18. Russ

    Russ Well-Known Member

    Joined:
    Jan 17, 2005
    Messages:
    5,722
    Likes Received:
    13
    Trophy Points:
    48
    Ah, that is good (and not necessarily old). I think the only restrictions on that is re-sale, right? Additionally, with that I think you should be eligible for the downgrade option (that I mentioned in another thread), which would allow you to get VC++ 6 (if you wanted to) for a reasonable price (something like $20), and that is the easiest solution for kX plugin development (for .dll plugins) as it includes the right version of MFC.

    Also, since you have MFC, then for a quick start, you may want to look at the FunctionX Visual C++ turorials first, as it also covers MFC GUI stuff, and MFC makes rapid GUI development much easier.

    BTW:
    You can do some kX programming with that version of VC++ without any problems and without having to jump through hoops. As LeMury indicated, the MFC requirement is on the kX GUI stuff which is mostly used by plugins. You can still do a lot of other things.

    (Just to clarify, by VC 2003, do you mean Visual C++ 2003 .NET Standard Edition?)
     
    Last edited: Dec 20, 2005
  19. Maddogg6

    Maddogg6 Tail Razer

    Joined:
    Jun 21, 2005
    Messages:
    4,027
    Likes Received:
    26
    Trophy Points:
    0
    Well, I mentioned old - cuz the disc looks like it - my friend doesn't take much care of his CD's - lol - as well it not being the last version..

    The NFR = Not Fo Re-sale - AFAIK - its a full version - BUT could be like a student version, It was given to a friend of mine in the biz (not a programmer tho) and he gave me this - 'to entice me into buying VS2005 from him' his words... not mine. So I have no clue how it may or may not be restricted.

    I had asked him for a VC6 - but he couldnt find his NFR version of that.

    The restriction I DO see - is the need for the MSDN subscription just to get the damn helpfile for it - thats what I get when I try to look at the help within the IDE. More $$$ there - just kinda rubs me the wrong way. But I will look into FunctionX -

    Keep in mind - Im just trying to learn this so I can play around - as I dont really have a NEED (read, Im self employed, and cant justify the cost on it as a biz expense) for VC in any any flavor.

    I guess - I was hoping to learn abit by trying my hand at a KX skin or plugin - because after looking at some of the existing skins - looks like its up my ally competence-wise.


    I'll prolly end up just un-installing VC2003 because of the missing help for it and my friend doesnt have the MSDN subscription either.

    I do understand C isnt the best language to begin learning programming - but I figured I would give it at least a 'lick and a promise' try. hehe.
     
  20. Maddogg6

    Maddogg6 Tail Razer

    Joined:
    Jun 21, 2005
    Messages:
    4,027
    Likes Received:
    26
    Trophy Points:
    0
    Yes - .net - heh ** I think - how do I know?
    The install routine (shows features and such) as I recall it was mentioned in there - other than that - there aint much to look at here.
     

Share This Page

visited