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

  • Home
  • SEARCH
  • 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 131767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T06:09:26+00:00 2026-05-11T06:09:26+00:00

I’m currently trying to use a certain SDK that has me loading functions off

  • 0

I’m currently trying to use a certain SDK that has me loading functions off a DLL that a vendor provides.. I have to pass arguments to these functions and the DLL does all the work..

Now, the DLL is supposed to be communicating with another device, while I just wait for the results. However, I don’t have this device, so how do I set up a mock interface to emulate the device?

To be clear, here’s an example:

myfuncpointer.Open(someparam,anotherparam,...); 

Now, because I don’t have the device, the DLL can’t actually perform the above function; it fails. How do I set up testing so that the DLL talks to a class that I designed rather than the device? Is there any way to redirect the DLL’s call?

How do I make a DummyDevice class to do this?

Thanks..

P.S. If anything is not clear, please don’t be too quick to downvote.. Comment as to what I need to explain and I’ll try to clear it up.. Thanks.


EDIT: What I DO have, however, is a spec sheet with all of the data structures used and the expected/legal values that it has to contain. So for example, if I call a function:

myfuncpointer.getinfo(param,otherparam); 

where one of the params is a data structure that the DLL fills up with info (say, if an option is enabled) after querying the device.. I can do this

param.option = true; 

after it has finished the getinfo call.

Is this a good way to test the code? It seems very very dangerous to trick this DLL into thinking all the wrong things and seems to be really really hard to scale even just a bit..

  • 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. 2026-05-11T06:09:26+00:00Added an answer on May 11, 2026 at 6:09 am

    Is emulated device access a stopgap solution for until you get hardware? If so, I recommend finding some other way to be productive: work on something else, write unit tests, etc.

    Is emulated device access a permanent requirement? If so, here are a few approaches you could take:

    1. If the other vendor’s SDK has a ‘simulation’ or ’emulation’ mode, use it. You might be surprised. You’re probably not the only client that needs to be able to test/run their application without the other vendor’s hardware installed.

    2. Take the other vendor’s code out of the picture. Emulate only the functionality that your application needs, and base it on your program’s requirements. Everything is under your control.

      a. Add an indirection layer. Use polymorphism to switch between two implementations: one that calls into the other vendor’s DLL, and one that emulates its behavior. Having your code call into an abstract base class instead of directly calling into the other vendor’s DLL also will make it easier to write unit tests for your code.

      b. Write a mock DLL (as Adam Rosenfield suggested). You need to match the function names and calling conventions exactly. As you upgrade to new versions of the other vendor’s DLL, you will need to extend the mock DLL to support any new entrypoints that your application uses.

      If you need to choose which DLL to use at runtime, this may require converting your code to load the DLL dynamically (but it sounds like you might already be doing this, given that you said something about function pointers). You may be able to decide at install time whether to install the other vendor’s DLL or the mock DLL. And if this is purely for testing purposes, you may be able to choose which DLL to use at compile time, and just build two versions of your application.

    3. Write a mock device driver (as others have suggested).

      If you have the spec for the interface between the other vendor’s user mode DLL and their device driver, this may be doable. It will probably take longer than any of the other approaches, even if you’re an experienced device driver developer, and especially if you don’t have the source to the other vendor’s DLL. UMDF (User Mode Driver Framework) might make this slightly easier or less time consuming.

      If the spec you mentioned does not describe the user/kernel interface, you will need to reverse engineer that interface. This is probably not going to be an effective use of your time compared with the other options, particularly if the driver interface is complex (e.g. it passes a lot of complex data structures to DeviceIoControl()).

      In both cases, you will need to revisit this every time you upgrade to a new version of the other vendor’s SDK. The same exported DLL functions may require using new DeviceIoControl() codes and structures.

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

Sidebar

Ask A Question

Stats

  • Questions 184k
  • Answers 184k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The colour object in .NET includes an alpha channel (i.e.… May 12, 2026 at 4:50 pm
  • Editorial Team
    Editorial Team added an answer I would strongly recommend tying that data together, possibly as… May 12, 2026 at 4:50 pm
  • Editorial Team
    Editorial Team added an answer You're running up against a general problem with HTTP over… May 12, 2026 at 4:50 pm

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
In order to apply a triggered animation to all ToolTip s in my app,
I have a French site that I want to parse, but am running into
I have text I am displaying in SIlverlight that is coming from a CMS

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.