How can one create .dll files with NASM?
Is is possible to assemble Assembly code into .dll files with NASM assembler? I need this because I want to link a .dll file containing Assembly code and a .dll file containing C++ code together, and load that .dll with JNI (Java Native Interface) that will call the C++ functions which are 开发者_C百科just wrappers for the Assembly functions. Compiling the C++ & Assembly code into two separate .dll modules, calling the "Assembly .dll code" from the "C++ .dll code" is also a possibility.
Best regards, Benjamin.
NASM just creates an object (.o/.obj) file, right? Why not link that into your C++ DLL by specifying it as an additional input on either the linker command line or the project properties?
you can create a dll with nasm and use alink as your linker. In your source use the following lines for every function in your dll: global myfunc
export myfunc
You need to provide a _dllmain function that gets called upon initialisation. Just return 1 in eax and retn 12 because you need to cleanup 3 args which aren't used here.
Assemble with -fobj (omf) then link with -dll added to the pe and GUI options
精彩评论