Access dll in linux












0















Okay so I have a bunch of .dll files that are compiled on windows (though I could recompile them on linux if that was necessary) that I want to use.



The final idea I am having is to write a .so that will be able to call the functions defined in the dlls.



As far as I have read this should be possible by using mono but I just can't seem to find any resource on how that might actually work. And by that I mean a specific example demonstrating the basics.



So let's assume I have a .dll that contains a function called getText() that will return the String "Hello World" when called.

How can I write my C++ code (I want it to be compiled to a .so so that's what I have to use, right?) that it calls that function and prints the returned String to the console? Is this even possible?



If the above scenario isn't possible: How can I use mono in general to access dlls? I have already written a C# example that does the job but ultimately I need a .so so this is not an option. Might there be some way to use mono from the command line to execute the function?





Another thing I found is the loadlibrary framework which seems to be capable of what I am looking for. However I have no clue how I would use it, so I'd appreciate a little code-example










share|improve this question

























  • the loadlibrary framework site has an example mpscript.c .... looks like the dll file has to be copied from windows to the engine sub-directory ...... just read the whole webpage ..... github.com/taviso/loadlibrary

    – jsotola
    Jan 8 at 18:23













  • If I understand correctly, linux cannot use dll files directly, but it works (with some dll files and in general with some Windows programs) with the interface program wine. See www.winehq.org - What is Wine?. Another 'almost' alternative is CygWin.

    – sudodus
    Jan 8 at 19:18













  • @jsotola thanks for pointing me to the website. I'll habe a look at this.

    – Raven
    Jan 8 at 21:14











  • @sudodus for my specific case I don't think that wine is an option but I'll have a look at CygWin

    – Raven
    Jan 8 at 21:15
















0















Okay so I have a bunch of .dll files that are compiled on windows (though I could recompile them on linux if that was necessary) that I want to use.



The final idea I am having is to write a .so that will be able to call the functions defined in the dlls.



As far as I have read this should be possible by using mono but I just can't seem to find any resource on how that might actually work. And by that I mean a specific example demonstrating the basics.



So let's assume I have a .dll that contains a function called getText() that will return the String "Hello World" when called.

How can I write my C++ code (I want it to be compiled to a .so so that's what I have to use, right?) that it calls that function and prints the returned String to the console? Is this even possible?



If the above scenario isn't possible: How can I use mono in general to access dlls? I have already written a C# example that does the job but ultimately I need a .so so this is not an option. Might there be some way to use mono from the command line to execute the function?





Another thing I found is the loadlibrary framework which seems to be capable of what I am looking for. However I have no clue how I would use it, so I'd appreciate a little code-example










share|improve this question

























  • the loadlibrary framework site has an example mpscript.c .... looks like the dll file has to be copied from windows to the engine sub-directory ...... just read the whole webpage ..... github.com/taviso/loadlibrary

    – jsotola
    Jan 8 at 18:23













  • If I understand correctly, linux cannot use dll files directly, but it works (with some dll files and in general with some Windows programs) with the interface program wine. See www.winehq.org - What is Wine?. Another 'almost' alternative is CygWin.

    – sudodus
    Jan 8 at 19:18













  • @jsotola thanks for pointing me to the website. I'll habe a look at this.

    – Raven
    Jan 8 at 21:14











  • @sudodus for my specific case I don't think that wine is an option but I'll have a look at CygWin

    – Raven
    Jan 8 at 21:15














0












0








0








Okay so I have a bunch of .dll files that are compiled on windows (though I could recompile them on linux if that was necessary) that I want to use.



The final idea I am having is to write a .so that will be able to call the functions defined in the dlls.



As far as I have read this should be possible by using mono but I just can't seem to find any resource on how that might actually work. And by that I mean a specific example demonstrating the basics.



So let's assume I have a .dll that contains a function called getText() that will return the String "Hello World" when called.

How can I write my C++ code (I want it to be compiled to a .so so that's what I have to use, right?) that it calls that function and prints the returned String to the console? Is this even possible?



If the above scenario isn't possible: How can I use mono in general to access dlls? I have already written a C# example that does the job but ultimately I need a .so so this is not an option. Might there be some way to use mono from the command line to execute the function?





Another thing I found is the loadlibrary framework which seems to be capable of what I am looking for. However I have no clue how I would use it, so I'd appreciate a little code-example










share|improve this question
















Okay so I have a bunch of .dll files that are compiled on windows (though I could recompile them on linux if that was necessary) that I want to use.



The final idea I am having is to write a .so that will be able to call the functions defined in the dlls.



As far as I have read this should be possible by using mono but I just can't seem to find any resource on how that might actually work. And by that I mean a specific example demonstrating the basics.



So let's assume I have a .dll that contains a function called getText() that will return the String "Hello World" when called.

How can I write my C++ code (I want it to be compiled to a .so so that's what I have to use, right?) that it calls that function and prints the returned String to the console? Is this even possible?



If the above scenario isn't possible: How can I use mono in general to access dlls? I have already written a C# example that does the job but ultimately I need a .so so this is not an option. Might there be some way to use mono from the command line to execute the function?





Another thing I found is the loadlibrary framework which seems to be capable of what I am looking for. However I have no clue how I would use it, so I'd appreciate a little code-example







shared-library mono






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 8 at 17:49







Raven

















asked Jan 8 at 17:42









RavenRaven

221115




221115













  • the loadlibrary framework site has an example mpscript.c .... looks like the dll file has to be copied from windows to the engine sub-directory ...... just read the whole webpage ..... github.com/taviso/loadlibrary

    – jsotola
    Jan 8 at 18:23













  • If I understand correctly, linux cannot use dll files directly, but it works (with some dll files and in general with some Windows programs) with the interface program wine. See www.winehq.org - What is Wine?. Another 'almost' alternative is CygWin.

    – sudodus
    Jan 8 at 19:18













  • @jsotola thanks for pointing me to the website. I'll habe a look at this.

    – Raven
    Jan 8 at 21:14











  • @sudodus for my specific case I don't think that wine is an option but I'll have a look at CygWin

    – Raven
    Jan 8 at 21:15



















  • the loadlibrary framework site has an example mpscript.c .... looks like the dll file has to be copied from windows to the engine sub-directory ...... just read the whole webpage ..... github.com/taviso/loadlibrary

    – jsotola
    Jan 8 at 18:23













  • If I understand correctly, linux cannot use dll files directly, but it works (with some dll files and in general with some Windows programs) with the interface program wine. See www.winehq.org - What is Wine?. Another 'almost' alternative is CygWin.

    – sudodus
    Jan 8 at 19:18













  • @jsotola thanks for pointing me to the website. I'll habe a look at this.

    – Raven
    Jan 8 at 21:14











  • @sudodus for my specific case I don't think that wine is an option but I'll have a look at CygWin

    – Raven
    Jan 8 at 21:15

















the loadlibrary framework site has an example mpscript.c .... looks like the dll file has to be copied from windows to the engine sub-directory ...... just read the whole webpage ..... github.com/taviso/loadlibrary

– jsotola
Jan 8 at 18:23







the loadlibrary framework site has an example mpscript.c .... looks like the dll file has to be copied from windows to the engine sub-directory ...... just read the whole webpage ..... github.com/taviso/loadlibrary

– jsotola
Jan 8 at 18:23















If I understand correctly, linux cannot use dll files directly, but it works (with some dll files and in general with some Windows programs) with the interface program wine. See www.winehq.org - What is Wine?. Another 'almost' alternative is CygWin.

– sudodus
Jan 8 at 19:18







If I understand correctly, linux cannot use dll files directly, but it works (with some dll files and in general with some Windows programs) with the interface program wine. See www.winehq.org - What is Wine?. Another 'almost' alternative is CygWin.

– sudodus
Jan 8 at 19:18















@jsotola thanks for pointing me to the website. I'll habe a look at this.

– Raven
Jan 8 at 21:14





@jsotola thanks for pointing me to the website. I'll habe a look at this.

– Raven
Jan 8 at 21:14













@sudodus for my specific case I don't think that wine is an option but I'll have a look at CygWin

– Raven
Jan 8 at 21:15





@sudodus for my specific case I don't think that wine is an option but I'll have a look at CygWin

– Raven
Jan 8 at 21:15










0






active

oldest

votes











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
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: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
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%2funix.stackexchange.com%2fquestions%2f493293%2faccess-dll-in-linux%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 Unix & Linux Stack Exchange!


  • 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%2funix.stackexchange.com%2fquestions%2f493293%2faccess-dll-in-linux%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

How to reconfigure Docker Trusted Registry 2.x.x to use CEPH FS mount instead of NFS and other traditional...

is 'sed' thread safe

How to make a Squid Proxy server?