Free C++ Compilers and KX DSP

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

  1. Lex Nahumury

    Lex Nahumury DH Senior Member

    Joined:
    Jan 5, 2003
    Messages:
    1,944
    Likes Received:
    6
    Trophy Points:
    0
    Yes, that was my original statement a few posts back;
    Ofcourse. 99% that that will work, but most of those 'free' M$ releases expire
    after some trial period and take Gigabytes of installation, system updates,
    web installs and crap like that.

    No. Max.M claimes he successfully linked kxapi with some free compiler,
    so it is possible afterall.
     
  2. Russ

    Russ Well-Known Member

    Joined:
    Jan 17, 2005
    Messages:
    5,722
    Likes Received:
    13
    Trophy Points:
    48
    Yeah, I know what you mean. I was looking at the FAQ for Visual C++ 2005 Express, and surprisingly it appears to have no restrictions. The faq stated that it (well all the express products) does not expire, and that are no restrictions on it's use (including developing commercial apps).
    http://msdn.microsoft.com/vstudio/express/support/faq/default.aspx

    Did you try that tool (coff2omf) that Max M. mentioned with C++ Builder?
     
  3. Lex Nahumury

    Lex Nahumury DH Senior Member

    Joined:
    Jan 5, 2003
    Messages:
    1,944
    Likes Received:
    6
    Trophy Points:
    0
    >>Did you try that tool (coff2omf) that Max M. mentioned with C++ Builder?
    Yep. IMPLIB too (and about every other tool out there), but the result is the same
    as with mingw; it compiles, but the entry points can not be found.

    Are you sure VC2005 express doesn't expire?
    My previous 2003 express did.
     
  4. Russ

    Russ Well-Known Member

    Joined:
    Jan 17, 2005
    Messages:
    5,722
    Likes Received:
    13
    Trophy Points:
    48
    I can only go by the info I saw, so I really can't say for sure, but that seems to be the case for the downloadable version.

    i.e. From the announcement in the MS Forum:
    https://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=126606&SiteID=1
     
  5. Russ

    Russ Well-Known Member

    Joined:
    Jan 17, 2005
    Messages:
    5,722
    Likes Received:
    13
    Trophy Points:
    48
    @LeMury,

    I have a few questions about creating a plugin using an alternative (non kxgui) GUI. You said you were able to do this (using platform SDK code), right? (or did you just mean that you have no problem creating GUI's using the win32 api framework, but you have not tried doing so with a plugin?)

    If so...

    Did you remove kxgui.lib from your linker options, and the kxgui related headers (from stdafx) when you did it? (i.e. just to be certain that you weren't using any functions that referenced kxgui elements)

    Where (as in what plugin function or event) did you create your window (considering we cannot use create_cp as it uses references to kxgui stuff)?

    What did you use for the parent window?

    Are there any GUI related notications that you needed to send yourself (i.e. tweak window was closed by the user, etc)?

    Were there any hacks/workarounds that you found to be necessary?

    I am just looking for any info that you may remember about it that could help save time for me and others when when trying to create a plugin this way. And of course, if anyone else has any info about this, please share it with us.

    Thanks,
    -Russ
     
  6. Russ

    Russ Well-Known Member

    Joined:
    Jan 17, 2005
    Messages:
    5,722
    Likes Received:
    13
    Trophy Points:
    48
    Does anyone know what actually is happenning in CKXPluginGUI::create() ?

    That seems to be the function that keeps us from being able to use newer version of the MFC libs with kxgui (although there could be more, I am not sure as it cannot get past that function (something is looking for a window handle before it has one)). If we knew exactly what that function is doing, then maybe would could do it manually ourselves in a way that would work with the newer MFC libs.
     
  7. Maddogg6

    Maddogg6 Tail Razer

    Joined:
    Jun 21, 2005
    Messages:
    4,027
    Likes Received:
    26
    Trophy Points:
    0
    I (of course..) cant answer this... but for fun I did a complete search (all files and folders including hidden and system ones) of my HDD for ANY text containing that function call - zero search results... this I thought was strange, I expected at least 1 result.
     
  8. Russ

    Russ Well-Known Member

    Joined:
    Jan 17, 2005
    Messages:
    5,722
    Likes Received:
    13
    Trophy Points:
    48
    That it is because the function is not written like that.
    CKXPluginGUI::create() basically means the create() function in the CKXPluginGUI class.
    If you look in kxplugingui.h you will see the class CKXPluginGUI, and you will see that one of it's functions is create().
     
  9. Lex Nahumury

    Lex Nahumury DH Senior Member

    Joined:
    Jan 5, 2003
    Messages:
    1,944
    Likes Received:
    6
    Trophy Points:
    0
    Well, if you study kxplugin.h, you'll see that kX provides
    a way for custom Dialog through generic abstract iKXPluginGUI class.

    Simply derive your custom Dialog class from iKXPluginGUI (not from CKXPluginGUI),
    and implement it's methods;
    void init_gui()
    void show_gui()
    void hide_gui()
    void close_gui()
    int extended_gui(int command,dword p1=0,dword p2=0)

    In plugin, create_cp(kDialog *parent, kFile *mf) is called on 'Tweak',
    and 'news' an instance of your Dialog class.
    Cast and use the kDialog *parent pointer which is passed to your Dialog's constructor.
    Tip: On return, create_cp() keeps a pointer in cp for reference.

    The rest is a matter of programming.

    In stdafx.h remove all refs to MFC and kxgui.
    Include "windows.h".
    Keep the kGUI forward declarations in kxapi.h ofcourse.
    Don't link to kxgui.lib.

    Yes, I use plain win32api to create the dialog and controls.
    Release builds are also possible.

    /LeMury
     
    Last edited: Dec 29, 2005
  10. Lex Nahumury

    Lex Nahumury DH Senior Member

    Joined:
    Jan 5, 2003
    Messages:
    1,944
    Likes Received:
    6
    Trophy Points:
    0
    add:
    Ofcourse instead of using win32api as I do,
    you are free to use whatever gui framework you want.
    You might just as well use some newer MFC-version.
    The trick is; not using kxgui..!
     
  11. Russ

    Russ Well-Known Member

    Joined:
    Jan 17, 2005
    Messages:
    5,722
    Likes Received:
    13
    Trophy Points:
    48
    Thanks LeMury, that is good to know. I had thought that kDialog was defined in kxgui.lib and that we could not use create_cp because of this, (I really hadn't thought it through completley). Release builds sound nice too (I hadn't thought about that, but that makes sense because we no longer need to use the debug version of the mfc .dll's). Good stuff, Thanks again. :)
     
  12. Russ

    Russ Well-Known Member

    Joined:
    Jan 17, 2005
    Messages:
    5,722
    Likes Received:
    13
    Trophy Points:
    48
    A few more things:

    I noticed that 'kDialog * parent' is always NULL, so I am not sure what the point of using (casting it to HWND) it is (as opposed to just setting the parent window to NULL). This would also would mean that we should not use the WS_CHILD style for our window.

    The extended_gui event: 'PLUGINGUI_SET_POSITION', always uses 0,0 when you first open the plugin window after it is loaded, which places it at the top left corner of the screen instead of centered (like it is with regular tweak windows). ('PLUGINGUI_CENTER' does not appear to be used when the window is first opened).

    I am still not sure what we are supposed to do when the window is closed by the user.
    i.e.
    Using a basic Win32 window class.

    In iKXPluginGUI we add a pointer to the window class.
    In 'create_cp' we create a new instance of our iKXPluginGUI.
    In 'init_gui' we create a new instance of our window class, and create the window.
    In 'close_gui' we destroy the window (and delete the window object), and then delete the iKXPluginGUI object.

    How should we handle WM_CLOSE of the window class so that kX knows that the window was closed, and the iKXPluginGUI object is destroyed properly, etc? I have tried a few different ways of handling this, and did not have much success in getting it to work properly.
     
  13. Lex Nahumury

    Lex Nahumury DH Senior Member

    Joined:
    Jan 5, 2003
    Messages:
    1,944
    Likes Received:
    6
    Trophy Points:
    0
    I'm using 3534 so there may be some diff, but try;

    In your message handler.......
    case WM_DESTROY:
    plugin->cp=0;
    break;


    and..
    void myGUI::close_gui()
    {
    DestroyWindow(hWnd);
    delete this;
    };

    /LeMury
     
    Last edited: Dec 28, 2005
  14. Russ

    Russ Well-Known Member

    Joined:
    Jan 17, 2005
    Messages:
    5,722
    Likes Received:
    13
    Trophy Points:
    48
    That is what I was missing. Thanks again.

    -Russ
     
  15. Lex Nahumury

    Lex Nahumury DH Senior Member

    Joined:
    Jan 5, 2003
    Messages:
    1,944
    Likes Received:
    6
    Trophy Points:
    0
    Yeah np.
    I wish Max.M would finaly comment on the -different compiler C++ ABI- issue.

    So far I still don't see how anyone can implicitly link to kaxpi.dll with a non MS compiler.
    The C++ ABIs between diff compilers are simply not compatible and there is no bintool that can fix that.

    Oh well, maybe it's a 'Big Secret'.

    /LeMury
     
  16. Maddogg6

    Maddogg6 Tail Razer

    Joined:
    Jun 21, 2005
    Messages:
    4,027
    Likes Received:
    26
    Trophy Points:
    0
    I have (I think is simple) a question...

    Is the evidence of KX using a custom GUI engine revealed by the fancy 'OK' and 'Cancel' buttons and such?

    I guess it just seems ALOT of hassle just to have fancy buttons in the GUI... Somthing I could certainly live without...

    [*hopes theres more to it than that*]
     
  17. Max M.

    Max M. h/h member-shmember

    Joined:
    Dec 7, 2002
    Messages:
    2,690
    Likes Received:
    9
    Trophy Points:
    63
    I apologize for my tactless remark, i was not intent. Yep, i had used msvc libs/dlls with borland/mingw compilers but that wasn't kxapi. There's no "big secret" - in fact, besides name mangling (i still believe it can be overcome) - another more important issue is present - calling convention (msvc's "thiscall" being used as default for kxapi absolutely differs with other compilers).

    /m
     
  18. Eugene Gavrilov

    Eugene Gavrilov kX Project Lead Programmer and Coordinator

    Joined:
    Dec 7, 2002
    Messages:
    3,146
    Likes Received:
    9
    Trophy Points:
    48
    I guess the only solution is to re-compile SDK-dependent part of the driver with 3-rd party compiler. and, probably, release some parts of the driver as opensource, "'strict' GPL license with exception". that is, I will try to release one kernel part of the code, ac-3 decoder, + KX API / KX GUI... in Jan'2006 (when I plan to release final 3538 release -- to let people keep the project running on a sourceforge-like site).

    E.
     
  19. Maddogg6

    Maddogg6 Tail Razer

    Joined:
    Jun 21, 2005
    Messages:
    4,027
    Likes Received:
    26
    Trophy Points:
    0
    Oh YEAH - WooHOO - this is GREAT news.... I think anyway...
     
  20. Lex Nahumury

    Lex Nahumury DH Senior Member

    Joined:
    Jan 5, 2003
    Messages:
    1,944
    Likes Received:
    6
    Trophy Points:
    0
    Apologies accepted and thanks for clearing this up.

    /LeMury
     

Share This Page

visited