I have an executable written in C that has some functions in it that I would like to use from a c# application. I have written plenty of dlls before and was able to use functions in them by prepending __declspec(dllexport)
to the function declaration. Can I do this from an executable? will the executable actually export the function?
相关问题
- dllimport /dllexport and static libraries compilat
- jump stubs in PE files
- How do I determine the architecture of an executab
- How do decorated names get into import libraries w
- Using a C# DLL in Delphi only uses the first funct
相关文章
- PE Format - IAT Questions
- Build shared library with Clang++
- How can `kernel32.dll` export an ordinal of 0, whe
- Can anyone define the Windows PE Checksum Algorith
- Where can I find a reference for what every bit of
- How to convert PE(Portable Executable) format to E
- How to compile C program as dll in Mingw for use w
- Using dllimport in place of dllexport
Yes you can! Yes the executable will export the functions. This is not done very often, but it works pretty good. According the Specification (http://msdn.microsoft.com/en-us/gg463119.aspx) of the Executable, there is no difference between DLL and Executable as far as the Exports is concerned. EXE like DLL can have an Export Table directory that documents the functions that will be exported by the image. As an Example of a "normal" Executable exporting functions, have a look at Chrome.exe. See the I made using PEStudio showing Chrome exporting some functions. Some Windows built-in Executable also export functions (e.g. the Local Security Authority Subsystem - lsass.exe). The Windows Kernel (ntoskrnl.exe) image also exports more than 2000 functions (on a Windows7 system).