DLL files are compiled, which means they are in machine code. If so how can a programmer invoke a function in DLL in a high level language like Java or C#?
1
Expert's answer
2014-01-08T10:26:47-0500
.NET framework has a set of compatibility tools for this purpose. In C# you'll need to write the following code in order to get access to "someclass" inside "somelibrary.dll": [DllImport("somelibrary.dll")] public extern someclass();
It is possible to use mix DLLs and EXEs built with different
compilers, or even written in different languages, as long as some
basic guidelines are followed. For an existing DLL, two issues need to
be considered: Was the DLL compiled with Cygwin? (If so, you may be
out of luck if you want to use an EXE built with anything else.) Which
language was used to write the DLL? (It makes a considerable
difference if C is used rather than C++.)
noviceprogammer
08.01.14, 17:35
so can we use any DLL regardless of the language it's written in?
Leave a comment
Thank you! Your comments have been successfully added. However, they need to be checked by the moderator before being published.
Comments
It is possible to use mix DLLs and EXEs built with different compilers, or even written in different languages, as long as some basic guidelines are followed. For an existing DLL, two issues need to be considered: Was the DLL compiled with Cygwin? (If so, you may be out of luck if you want to use an EXE built with anything else.) Which language was used to write the DLL? (It makes a considerable difference if C is used rather than C++.)
so can we use any DLL regardless of the language it's written in?
Leave a comment