locked
Writing a VC++ add-in for VS 2010 RRS feed

  • Question

  • Hi.

    I am very new to VS extensibility. I am trying to write an add-in that uses libdwarf. Since libdwarf is written in C, I assume my only option is to write the add-in in VC++ (ATL).

     

    Just to get the feel, I created an add-in project with VC++ (ATL) as it;s language. Even before I add a single line of code, I get about 60 compile errors of various kinds...

    Some are missing files, namespaces, etc.

    Just to see what happen when things do work, I started a new C# add-in project. That one compiled and ran immediately.

    Does anyone have and idea what's wrong?

    Thanks.

     

    Thursday, March 17, 2011 1:48 PM

Answers

  • What kind of errors are you seeing?  I tried reproing and I got a mixed bag.  First there is one error if you aren't running as admin as the build tries to register the dll (which requires write access to HKLM, which requires administrator privledges).  There are two ways around this

    1:  Run VS as admin.

    2:  Go to Project->Properties->Configuration Properties->Linker->General and change 'Per-User Redirection' from its default value of No to Yes.

    Other than that there are a bunch of Intellisense errors, well they aren't really errors even though they are reported as such :(  I.e. they are problems the intellisense parser (the EDG Parser) has encountered and brought up, but they aren't stopping the build, and should disappear on your next build, at least they do with me.

    As for do you have to do this in C++?  It depends. If libdwarf exports C style functions from a dll you can use pInvoke in any .NET language to make calls into those exported functions. If they only ship as a static library that you link into your code then yes you need to use C++ to some extent. There are really two choices in this case.

    1:  Use native C++ to do the entire AddIn.

    2:  Create a Managed C++ wrapper that simply exposes the functionality you want to use from libdwarf and then create a C#/VB/etc... AddIn/Package that references the managed C++ wrapper and uses it to get at the functionality you want to use.

    Ryan

    Thursday, March 17, 2011 5:08 PM