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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:21:39+00:00 2026-05-26T07:21:39+00:00

C++ dll function declaration is static void __clrcall BubbleSort(int* arrayToSort,int size); My C++ dll

  • 0

C++ dll function declaration is

static void __clrcall BubbleSort(int* arrayToSort,int size);

My C++ dll function is

void Sort::BubbleSort(int* sortarray,int size)
    {
        int i,j;
        int temp=0;
       for(i=0; i< (size - 1); ++i)
        {
            for(j = i + 1; j > 0; --j)
            {
                if(sortarray[j] < sortarray[j-1])
                {
                    temp = sortarray[j];
                    sortarray[j] = sortarray[j - 1];
                    sortarray[j - 1] = temp;
                }
            }
        }
    }

In C#, I am accesssing above function as

Sort.Sort.BubbleSort(arrayToBeSort,5);

But C sharp compiler gives error as

The best overloaded method match for ‘Sort.Sort.BubbleSort(int*, int)’ has some invalid arguments
and
Argument 1: cannot convert from ‘int[]’ to ‘int*’

  • 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-26T07:21:39+00:00Added an answer on May 26, 2026 at 7:21 am

    Arrays in managed C++ need to use the managed syntax.

    static void __clrcall BubbleSort(array<int>^ arrayToSort, int size)
    

    This translates in C# to

    public static void BubbleSort(int[] array, int size);
    

    Your declaration, instead matches the C# declaration using pointers (unsafe code).

    public static void BubbleSort(int* array, int size);
    

    If you need to pass a value by reference you should write something like this:

    static void __clrcall MyFunc(array<int>^% arrayByReference)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following declaration for SHChangeNotify : [DllImport(Shell32.dll)] public static extern void SHChangeNotify(HChangeNotifyEventID
Given the following Delphil DLL declaration function csd_HandleData(aBuf: PChar; aLen: integer): integer; stdcall; what
I have a function in a native DLL defined as follows: #include <string> void
I have a function with the following declaration: void playCard(string card); and the following
I have the following declaration in a Module: Private Declare Function gzopen Lib ZLIB.DLL
I want to use LabVIEW's Call Library Function Node to access a DLL function,
How can I find the parameters of an undocumented Dll function? I have searched
I have a Delphi DLL with a function defined as: function SubmitJobStringList(joblist: tStringList; var
Given the following C function in a DLL: char * GetDir(char* path ); How
I have a DLL which provided a decoding function, as follows: function MyDecode (Source:

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.