Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1808454
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T06:15:47+00:00 2026-05-17T06:15:47+00:00

I’m having some difficulties while trying to consume an unmanaged-code dll from my application

  • 0

I’m having some difficulties while trying to consume an unmanaged-code dll from my application (written in C# framework 4.0).
I’m using the dll import as follows

[DllImport(@"C:\MGW_SDK.dll", EntryPoint = "fInicializaSDK")]
public static extern int fInicializaSDK();

The weird thing is that when called from my development environment (Windows XP) it works just fine, but when on the production server (Windows7) it generates the following exception:

System.DllNotFoundException: Unable to load DLL ' C:\MGW_SDK.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E) at Comtpaq.AdminPack.SDKWrapper.fInicializaSDK() at Comtpaq.AdminPack.AdminPaqRepository.InitializeSDK() in C:\Work\AgroIn\AdminPaqRepository.cs:line 30

I already ran Dependency Walker, which shows the following dependency as conflicted: C:\windows\system32\SHLWAPI.DLL

I already tried copying that dll to my deployment directory

The MGW_SDK.dll is on c:\ (as the path says)

I already installed C Runtime Library

I also noticed some interesting stuff: on the exception, the development path is showing C:\Work\AgroIn\AdminPaqRepository.cs:line 30

What else could be the problem here?

Edit

I built a small console application with just one of the extern/dllimport methods that I use from MGW_SDK.dll and ran it with no problem (no DllNotFoundException whatsoever), so this seems to be related to the application that I’m building (a WCF Service). This service is hosted on the WAS, but I’m still unable to find the issue.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T06:15:48+00:00Added an answer on May 17, 2026 at 6:15 am

    Well, this was a very tricky problem. It was not related to dll dependencies and not related to the dll location either. It was not about how I was calling the DllImport. It was a permissions problem.

    Basically this issue is solved by taking out and then adding back the permissions for execute on the folder where the dlls are. See this article (Wayback machine).

    Solution


    Oracle 9.2 Client software requires that you give the Authenticated
    User privilege to the Oracle Home by following these steps:

    1. Log on to Windows as a user with Administrator privileges.

    2. Launch Windows Explorer from the Start Menu and and navigate to the ORACLE_HOME folder. This is typically the “Ora92” folder under the “Oracle” folder (i.e. D:\Oracle\Ora92).

    3. Right-click on the ORACLE_HOME folder and choose the “Properties” option from the drop down list. A “Properties” window should appear.

    4. Click on the “Security” tab of the “Properties” window.

    5. Click on “Authenticated Users” item in the “Name” list (on Windows XP the “Name” list is called “Group or user names”).

    6. Uncheck the “Read and Execute” box in the “Permissions” list under the “Allow” column (on Windows XP the “Permissions” list is called “Permissions for Authenticated Users”).

    7. Re-check the “Read and Execute” box under the “Allow” column (this is the box you just unchecked).

    8. Click the “Advanced” button and in the “Permission Entries” list make sure you see the “Authenticated Users” listed there with:

        Permission = Read & Execute 
        Apply To = This folder, subfolders and files 
      

      If this is NOT the case, edit that line and make sure the “Apply onto” drop-down box is set to “This folder, subfolders and files”. This should already be set properly but it is important that you verify this.

    9. Click the “Ok” button until you close out all of the security properties windows. The cursor may present the hour glass for a few seconds as it applies the permissions you just changed to all subfolders and files.

    10. Reboot your computer to assure that these changes have taken
      effect (IMPORTANT).

    Re-execute the application and it should now work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having some difficulties while trying to understand the radio buttons logic. I
I'm having some difficulties while trying to understand the whole zend routing concept. My
I am having some difficulties on trying this buddypress code to work: <?php $args
I'm trying to replicate some C# code in PHP5 and am having some difficulties.
I'm having some difficulties creating a javascript appointment style calendar. While it does render,
I am using a AJAX gallery called jCarousel, and I am having some difficulties
I'm trying to get an insert to work using LINQ and am having some
I'm having some difficulties with uploading an image from an html form. The form
I'm in Visual Studio, making a Windows Forms application. I'm having some difficulties with
Im having some difficulties trying to order my list of a resultset. Im trying

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.