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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:16:33+00:00 2026-05-11T20:16:33+00:00

I have 2 C++ DLLs. One of them contains the following function: void init(const

  • 0

I have 2 C++ DLLs. One of them contains the following function:

void init(const unsigned char* initData, const unsigned char* key)

The other one contains this function:

BYTE* encrypt(BYTE *inOut, UINT inputSize, BYTE *secretKey, UINT secretKeySize).

Is there a way to call these 2 functions from C#? I know you can use [DllImport] in C# to call C++ functions, but the pointers are giving me a hard time.

Any help would be appreciated!

  • 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-11T20:16:33+00:00Added an answer on May 11, 2026 at 8:16 pm

    Yes, you can call both of these from C# assuming that they are wrapped in extern “C” sections. I can’t give you a detailed PInvoke signature because I don’t have enough information on how the various parameters are related but the following will work.

    [DllImport("yourdllName.dll")]
    public static extern void init(IntPtr initData, IntPtr key);
    
    [DllImport("yourdllName.dll")]
    public static extern IntPtr encrpyt(IntPtr inout, unsigned inuputSize, IntPtr key, unsigned secretKeySize);
    

    Pieces of information that would allow us to create a better signature

    1. Is the return of encrypt allocated memory?
    2. If #1 is true, how is the memory allocated
    3. Can you give a basic description on how the parameters work?
    4. I’m guessing that all of the pointer values represents arrays / groups of elements instead of a single element correct?
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two similar (not identical) dlls, one of them being actually a part
I have two DLLs compiled separately, one is compiled from Visual Studio 2008 and
In my application, I have two DLLs. One is written in C# and the
I have a project with few dlls. I would like to change one of
I have couple resource DLLs that I currently load when application starts using following
We have few components like libraries dlls When initially created I ran the following
Let's say we have multiple libraries (DLLs) whose features one wants to use in
I have 2 C# projects in my solution, both of them DLLs: MyApp.UI.WPF.csproj MyApp.UI.WinForms.csproj
We have been distributing OleAut32.dll and olepro32.dll (and other DLLs that are in the
I have these dlls installed on my box. What are the differnces between them

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.