Community
    • Login

    Using C++ standard library in Notepad++ plugins.

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    2 Posts 2 Posters 37 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M Offline
      matsnorberg
      last edited by

      I’m a complete newbe at plugin programming and have lots of things to learn. Lots, lots, tons of things!!

      Now I wonder if it’s safe to use the C++ standard library in my plugins. Will another user be able to run the plugin if he hasn’t a C++ toolchain installed? Would I have to statically link the standard library and the C/C++ runtime or would Visual Studio do this for me by default?

      How do you do? Do you call std:: functions in your plugins or do you avoid them?

      CoisesC 1 Reply Last reply Reply Quote 0
      • CoisesC Offline
        Coises @matsnorberg
        last edited by

        @matsnorberg:

        Notepad++ is compiled with static linking, and it’s best to do that for plugins as well. Right-click the project, select Properties, then C++ > Code Generation and set Runtime Library to /MT for Release builds and /MTd for debug builds.

        If you use the official plugin template, the supplied solution file already sets static linking.

        Note that this is OK because Notepad++ and plugins never pass C++ objects between one another. The plugin API is a pure C interface.

        The only time this might cause a problem is if your DLL links further DLLs which were compiled with dynamic linking.


        A side note: you might want to take a look at a project I created, NppCppMSVS: Visual Studio Project Template for a Notepad++ C++ Plugin. It’s a template you can add to Visual Studio so that you can easily start a new plugin project directly from Visual Studio. As noted in the readme, This project is not a part of Notepad++ and is not endorsed by the author of Notepad++. With that understanding, you might want to take a look at its documentation and see if you think it would be an easier place to start than the official plugin template (which is a GitHub template, not a Visual Studio template).

        1 Reply Last reply Reply Quote 1

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • First post
          Last post
        The Community of users of the Notepad++ text editor.
        Powered by NodeBB | Contributors