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 870811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T10:32:19+00:00 2026-05-15T10:32:19+00:00

I was gaven a C++ dll file, a lib file and a header file.

  • 0

I was gaven a C++ dll file, a lib file and a header file. I need to call them from my C# application.

header file looks like this:

class Clog ;

class EXPORT_MACRO NB_DPSM
{
private:
    string sFileNameToAnalyze ;

    Clog *pLog ;

    void write2log(string text) ;

public:
    NB_DPSM(void);
    ~NB_DPSM(void);

    void setFileNameToAnalyze(string FileNameToAnalyze) ;    
    int WriteGenbenchData(string& message) ;
};

In my C# code, I have those code:

internal ReturnStatus correctDataDLL(string rawDataFileName)
        {
            if (rawDataFileName == null || rawDataFileName.Length <= 0)
            {
                return ReturnStatus.Return_CannotFindFile;
            }
            else
            {
                setFileNameToAnalyze(rawDataFileName);                          
            }

            string msg = "";
            int returnVal = WriteGenbenchData(ref msg);


            return ReturnStatus.Return_Success;
        }

[DllImport("..\\..\\thirdParty\\cogs\\NB_DPSM.dll")]
public static extern void setFileNameToAnalyze(string fileName);


[DllImport("..\\..\\thirdParty\\cogs\\NB_DPSM.dll")]
public static extern int WriteGenbenchData(ref string message);

I got EntryPointNotFoundException at the setFileNameToAnalyze(rawDataFileName); statement.

Few questions:

  1. do I need to add that lib file into somewhere of my C# project? how?

  2. do I need to add the header file into my C# project? how? (no compile error for now)

  3. I would like to remove those "..\\..\\thirdParty\\cogs\\" hardcode path. how to this?

  4. how to get ride of that EntryPointNotFoundException?

thanks,

  • 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-15T10:32:20+00:00Added an answer on May 15, 2026 at 10:32 am

    You don’t need to include either the header file or the lib file in your C# project. These files are useless to you anyway.

    The reason you are getting an EntryPointNotFound exception is that you’ve provided incorrect names for those entry points. When you compile a C++ project, the compiler mangles the names by adding additional information about parameters and return types. (You can use the dumpbin.exe utility to see these entry points.)

    The real problem, however, is that your DLL evidentally contains a C++ class. “setFileNameToAnalyze” and “WriteGenbenchData” are instance methods of that class, not static functions. You can’t call them without creating an instance of the NB_DPSM class first.

    It might be possible to do that using only P/Invoke, but at this point I think it’s likely more trouble than it’s worth. You should create a managed C++ class library to wrap the old DLL instead.

    As to part (3) of your question, just remove the paths and make sure that NB_DPSM.dll resides in the same bin directory as the result of your output files.

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

Sidebar

Related Questions

In our application, we dynamically load a dll file, which again has static bindings
I have some C code that compiles to a DLL. From C#, I need
I have been given a small library, consisting of a .dll, a .h header
I have a DLL which contains a class with static members . I use
Question: Is it possible to compile a program on linux using a .dll file?
I have converted a dll to lib. I gave it the lib and dll
First of all, sorry to post a question like this when so many other
My question is similar to Getting CLSID for a DLL file? , I think.
I have C# wrapper code that calls functions from a native (C++) dll. Currently,
I am trying to figure out what process locks a file using the class

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.