How to declare a pointer to a character array in C# (importing C library function)?












0















I have a library written in C, and I'm supposed to use this library in C#. I don't have access to the source code.



The original function is defined as



typedef char TYPE[32];
int function(TYPE* text);


Now, if my C knowledge is okay, that would be the equivalent of char (*text)[32]. How do I port this to C#?



EDIT: I have a DLL and a header file. The typedef and the function are declared in the header file. I'm supposed to DllImport this function to my C# code. How do I do that?










share|improve this question

























  • you need to read up on P/Invoke. That is the droid you are using for old Unamanged code you are calling.

    – Christopher
    Nov 15 '18 at 13:40











  • Your google-fu is weak :) See Mattias Sjögren's answer (Nov 17 '05) on bytes.com.

    – pmg
    Nov 15 '18 at 13:51













  • Guys, thanks for your answers, but I may not be able to express myself correcty. Please see my edit.

    – Oregano
    Nov 15 '18 at 14:09











  • Possible duplicate of equivalent char* in C#

    – Pete Kirkham
    Nov 15 '18 at 14:32
















0















I have a library written in C, and I'm supposed to use this library in C#. I don't have access to the source code.



The original function is defined as



typedef char TYPE[32];
int function(TYPE* text);


Now, if my C knowledge is okay, that would be the equivalent of char (*text)[32]. How do I port this to C#?



EDIT: I have a DLL and a header file. The typedef and the function are declared in the header file. I'm supposed to DllImport this function to my C# code. How do I do that?










share|improve this question

























  • you need to read up on P/Invoke. That is the droid you are using for old Unamanged code you are calling.

    – Christopher
    Nov 15 '18 at 13:40











  • Your google-fu is weak :) See Mattias Sjögren's answer (Nov 17 '05) on bytes.com.

    – pmg
    Nov 15 '18 at 13:51













  • Guys, thanks for your answers, but I may not be able to express myself correcty. Please see my edit.

    – Oregano
    Nov 15 '18 at 14:09











  • Possible duplicate of equivalent char* in C#

    – Pete Kirkham
    Nov 15 '18 at 14:32














0












0








0








I have a library written in C, and I'm supposed to use this library in C#. I don't have access to the source code.



The original function is defined as



typedef char TYPE[32];
int function(TYPE* text);


Now, if my C knowledge is okay, that would be the equivalent of char (*text)[32]. How do I port this to C#?



EDIT: I have a DLL and a header file. The typedef and the function are declared in the header file. I'm supposed to DllImport this function to my C# code. How do I do that?










share|improve this question
















I have a library written in C, and I'm supposed to use this library in C#. I don't have access to the source code.



The original function is defined as



typedef char TYPE[32];
int function(TYPE* text);


Now, if my C knowledge is okay, that would be the equivalent of char (*text)[32]. How do I port this to C#?



EDIT: I have a DLL and a header file. The typedef and the function are declared in the header file. I'm supposed to DllImport this function to my C# code. How do I do that?







c# c arrays pointers






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 15 '18 at 14:11







Oregano

















asked Nov 15 '18 at 13:38









OreganoOregano

274




274













  • you need to read up on P/Invoke. That is the droid you are using for old Unamanged code you are calling.

    – Christopher
    Nov 15 '18 at 13:40











  • Your google-fu is weak :) See Mattias Sjögren's answer (Nov 17 '05) on bytes.com.

    – pmg
    Nov 15 '18 at 13:51













  • Guys, thanks for your answers, but I may not be able to express myself correcty. Please see my edit.

    – Oregano
    Nov 15 '18 at 14:09











  • Possible duplicate of equivalent char* in C#

    – Pete Kirkham
    Nov 15 '18 at 14:32



















  • you need to read up on P/Invoke. That is the droid you are using for old Unamanged code you are calling.

    – Christopher
    Nov 15 '18 at 13:40











  • Your google-fu is weak :) See Mattias Sjögren's answer (Nov 17 '05) on bytes.com.

    – pmg
    Nov 15 '18 at 13:51













  • Guys, thanks for your answers, but I may not be able to express myself correcty. Please see my edit.

    – Oregano
    Nov 15 '18 at 14:09











  • Possible duplicate of equivalent char* in C#

    – Pete Kirkham
    Nov 15 '18 at 14:32

















you need to read up on P/Invoke. That is the droid you are using for old Unamanged code you are calling.

– Christopher
Nov 15 '18 at 13:40





you need to read up on P/Invoke. That is the droid you are using for old Unamanged code you are calling.

– Christopher
Nov 15 '18 at 13:40













Your google-fu is weak :) See Mattias Sjögren's answer (Nov 17 '05) on bytes.com.

– pmg
Nov 15 '18 at 13:51







Your google-fu is weak :) See Mattias Sjögren's answer (Nov 17 '05) on bytes.com.

– pmg
Nov 15 '18 at 13:51















Guys, thanks for your answers, but I may not be able to express myself correcty. Please see my edit.

– Oregano
Nov 15 '18 at 14:09





Guys, thanks for your answers, but I may not be able to express myself correcty. Please see my edit.

– Oregano
Nov 15 '18 at 14:09













Possible duplicate of equivalent char* in C#

– Pete Kirkham
Nov 15 '18 at 14:32





Possible duplicate of equivalent char* in C#

– Pete Kirkham
Nov 15 '18 at 14:32












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53320740%2fhow-to-declare-a-pointer-to-a-character-array-in-c-sharp-importing-c-library-fu%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53320740%2fhow-to-declare-a-pointer-to-a-character-array-in-c-sharp-importing-c-library-fu%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Bressuire

Vorschmack

Quarantine