VB.NET app calling C++ dll, DLLNotFoundException

Posted on 2008-11-17
Last Modified: 2012-05-05
I have here C++ dlls that has been compiled as a 32bit dll.
It is called by .NET windows service, compiled as 32bit as well.
Provided below is a sample code to to use the methods of the C++dll

<DllImport("mytest.dll") , entrypoint:="mytestmethod1")>
public shared function mytestmethod1() as string
end function

This works in 32 bit.

My problem is this  - to make same code run in 64bit.
The C++ dll and the .NET windows service are now compiled as 64bit.
When i start to run the .NET windows service, I get an error as soon as I hit a code calling the C++ method -  a DllNotFoundException exception. so nonetheless, i added try catch statements for DllNotFoundException.

Im still getting this error but Im dead sure i have the c++ dll in the .NET windows service bin directory.

please help.
Question by:jermineM
    LVL 43

    Expert Comment

    Give the 64 bit version a different name to the 32 bit version - modify your Dllimport code - does it still fail with the dllnotfoundexception?

    Accepted Solution

    Recompiled the C++ to create using a new dll name. Copied the dll into the VB.NET bin folder.
    Replaced the DLL name used  in the wrapper.
    Still encountering DllNotFoundException.

    any other ideas?

    LVL 43

    Expert Comment

    Nope - it was a long shot.

    Author Comment

    thanks for the suggestion though :)

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now