How to load DLL through loadlibrary in different EXE of WinCE

Source: Internet
Author: User

 

1. Problem Description

 

During the product testing process, we noticed such a phenomenon, whether it is C ++ or a program developed with C #, which will exist when DLL is dynamically called: both a.exeand B .exe use loadlibrary (_ T ("deviceapi. DLL ") to call the deviceapi. DLL maps to the process space of the calling process. The handler actually maps deviceapi. DL in the folder rather than the B folder to its own process space.

 

2. Problem Analysis

In the loadlibrary Function Description in msdn, There is a description like this: "When Windows Embedded ce loads a DLL, all path information is ignored when determining if the DLL is already loaded. this means that a DLL with the same name but a different path can only be loaded once. in addition, a module ending with the extension. CPL is treated as if the extension is. DLL. ". Link: http://msdn.microsoft.com/en-us/library/ee488148 (V = winembedded.60). aspx. The handler specifies the dll path when calling loadlibrary, and wince will ignore it. This means that the DLL with the same name in different paths can only be loaded once for the wince system. The extension is CPL (control panel program) modules with the same name extension as DLL (loadlibrary can also load CPL modules ).
 

 

3. problem avoidance and Solution

Due to this limitation of the wince system, users are bound to be inconvenient. However, we only need to do the following to avoid this problem:

When you open a.exe, you can open B .exe. you can close a.exeand then open B .exe to avoid this problem. However, in some application scenarios, you may need to open both EXE files.

The same dlluses different names. For example, if deviceapia.dllis installed on a.x, B .exe loads deviceapib. dll, but in fact they all load deviceapi. dll.

These methods are just to avoid this problem, but there is no way to fundamentally solve these problems. If you know it, I hope to share it with you. Thank you!

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.