1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

AddToHistory() produces a linker error

Discussion in 'Plugins' started by thomasl, Aug 3, 2011.

  1. thomasl

    Joined:
    Jun 10, 2008
    Messages:
    35
    Likes Received:
    0
    It seems TakeCmd.h contains an incomplete declaration for AddToHistory(). If I use the .h from the latest SDK I receive a linker error that the function can't be found.

    I unmangled the name in TakeCmd.lib and it seems the function has an int as its second parameter. At least, once I changed the .h accordingly, the linker was happy.

    I gotta say that using the SDK proved to be more troublesome than it should be, IMHO. Not to mention the documentation or rather lack of it.

    --
    cheers thomasl
     
  2. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,732
    Likes Received:
    81
    function

    AddToHistory was changed in 12.10 to take a second optional argument. If
    you use it in that format, your plugin won't work in any previous version.

    void WINAPI AddToHistory( LPTSTR, int nForceAppend=0 );


    should

    Which is largely because I don't WANT developers using more than a small
    fraction of the SDK, as it makes it impossible for me to update TCMD without
    breaking everybody's plugins.

    The SDK is there for a small core set of functions that you can't do any
    other way, not as a general RTL replacement library that will remain
    unchanged forever.

    Rex Conn
    JP Software
     
  3. thomasl

    Joined:
    Jun 10, 2008
    Messages:
    35
    Likes Received:
    0
    I take it that means that if I want to have my plugin work in previous versions I have to use an pre-12.10 SDK version?

    Anyway, as things stand right now, I can't link with the current version of the SDK w/o editing the TakeCmd.h file.

    --
    cheers thomasl
     
  4. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,732
    Likes Received:
    81
    There's no reason for you to use AddToHistory -- you should use "HISTORY /A command" if you want to add something to the history. That interface will never change.
     
  5. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,792
    Likes Received:
    29
    On Fri, 05 Aug 2011 21:11:52 -0400, rconn <> wrote:

    |There's no reason for you to use AddToHistory -- you should use "HISTORY /A command" if you want to add something to the history. That interface will never change.

    Do you mean HistoryCmd() or Command(L"HISTORY ...")?
     
  6. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,732
    Likes Received:
    81
    Either one. History_Cmd(pszLine) is slightly faster if you don't need any
    preprocessing (aliases, variables, redirection, etc.).

    Rex Conn
    JP Software
     
  7. thomasl

    Joined:
    Jun 10, 2008
    Messages:
    35
    Likes Received:
    0
    Thanks, though you could usefully have mentioned that in your first post.

    Either way, I'd prefer an SDK that actually does what it says on the tin. Well.

    --
    cheers thomasl
     
  8. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,732
    Likes Received:
    81
    I didn't understand at first why you were ignoring the easy documented way of doing it in favor of the hard undocumented way.

    The SDK on the ftp site has the updated TakeCmd.h file.
     

Share This Page