Answer to Question #38178 in Programming & Computer Science for eranjene sandun

Question #38178
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();

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

Assignment Expert
09.01.14, 17:45

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

LATEST TUTORIALS
APPROVED BY CLIENTS