CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Thread: C# call C++ dll

  1. #1
    Join Date
    Aug 2002
    Posts
    33

    C# call C++ dll

    I created a new managed Dll which will wrap my existing MFC Dll. How can I call this new Dll class from C#? Where can I find some sample how to do this?

    Thanks for any information...

  2. #2
    Join Date
    Apr 2003
    Location
    bangalore
    Posts
    31

    My comment

    hi,

    I dont know, whether it is right solution or not, but i think, you should add that dll in references of your project, where you want to use. If you want to use in project1, then in its references, give the path of dll. Then i think, you can able to use.

    bye

  3. #3
    Join Date
    Aug 2002
    Posts
    33
    Thanks raghavkotha, I just figured that out ater play with the Studio. I was able to build the project. The problem right now is running the application. The error message I got is that it's looking for assembly file belong to this Dll. I coudn't find this file anywhere at all...

  4. #4
    Join Date
    Nov 2002
    Location
    Singapore
    Posts
    1,890
    are you using the dllattributes ? and calling the functions. then you don't need the assembly for C++ dlls.

    in other case you will need to add the reference of the DLL/Assembley manifest in your project reference.


    - Paresh
    - Software Architect

  5. #5
    Join Date
    Aug 2002
    Posts
    33
    I did add the reference to the project and it find the classes inside that DLL without any problem during compile and link processes. When I try to run the web page, it couldn't find the assembly file belong to this Dll.

    The error message like this:

    Parse error Message : File or assembly name FdcDraw, or one of its dependencies, was not found


    Thanks for any help,...

  6. #6
    Join Date
    Nov 2002
    Location
    Singapore
    Posts
    1,890
    you need the dll keep in path. put in either windows folder or give a path of that dll.
    - Software Architect

  7. #7
    Join Date
    Aug 2002
    Posts
    33
    Damm, that's the problem... as soon as the dll is in the search path, the problem is gone away. Thanks for all the help. I lost so many hair (from scratching, pulling, ...) and some more gray hair because of this...

  8. #8
    Join Date
    Nov 2002
    Location
    Singapore
    Posts
    1,890
    LOL,
    someone should write a program to count your lost hairs

    LOL


    Paresh
    - Software Architect

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured