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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:52:19+00:00 2026-06-11T01:52:19+00:00

I want to compile a c++ program to a dll and use it from

  • 0

I want to compile a c++ program to a dll and use it from c#.

This is the c++ program:

MurmurHash3.h MurmurHash3.cpp

I changed the header and the method declaration in the h and c++ file from:

void MurmurHash3_x64_128 ( const void * key, int len, uint32_t seed, void * out );

to

extern "C" __declspec(dllexport) void MurmurHash3_x64_128 
    (const void * key, const int len, const uint32_t seed, void * out )

I did the same for all three methods. Then I set the compile target to dll. After compiling it I had a x64 bit dll named SMHasher.dll. Now I created a new x64 bit C# programm and used this dll as reference.

Then I wrote the following:

[DllImport("SMHasher.dll")]
public static extern void MurmurHash3_x64_128(byte[] valueToHash, int len, uint seed, out byte[] hash);

private void button1_Click(object sender, EventArgs e)
{
    byte[] hash;
    MurmurHash3_x64_128(new byte[] { 1, 2, 3 }, 3, 0, out hash);
}

When calling MurmurHash3_x64_128 my test app gets closed without any error message.

What is the problem? And how can I solve it?

Maybe the problems are the c++ parameters? Maybe “const void * key” is not a byte array?

  • 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-06-11T01:52:20+00:00Added an answer on June 11, 2026 at 1:52 am

    This error is occurring because you are a 64-bit app importing a 32-bit dll, or a 32-bit app importing a 64-bit dll.

    Make sure you LoadLibrary a dll of the same bittedness of your app.

    In C#, you can set the bittedness of your app through the use of the configuration properties in Visual Studio.

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

Sidebar

Related Questions

I'm new to C programming. I want to compile C program using Make file.
So I have this C .dll source code which I want to use in
I created a dll file. This file is compiled as C code. I want
So I want to compile a Haskell program locally, and then upload it to
I want to compile a simple hello-world-style program using the Windows command line. cl
I want to compile a simple C program with GCC. What do I need
I want to compile a "Hello World" MS-DOS exe. Not a program that runs
I want to make a program work and compile in both WIN\Linux . I
when i want compile my app with the Distribution or Release method i get
I am writing a program in C++ using Eclipse. I want to compile it

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.