Вобщем написал программу подключения библиотеки и саму библиотеку при компиляции библиотеки выдает ошибку... Код | Microsoft (R) Macro Assembler Version 6.14.8444 Copyright (C) Microsoft Corp 1981-1997. All rights reserved.
Assembling: LoadDll.asm Microsoft (R) Incremental Linker Version 5.12.8078 Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
Microsoft (R) Macro Assembler Version 6.14.8444 Copyright (C) Microsoft Corp 1981-1997. All rights reserved.
Assembling: SocketServer.asm Microsoft (R) Incremental Linker Version 5.12.8078 Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
Creating library SocketServer.lib and object SocketServer.exp SocketServer.dll : warning LNK4086: entrypoint "_DLLENTRY" is not __stdcall with 12 bytes of arguments; image may not run LINK : error LNK2001: unresolved external symbol _DLLENTRY SocketServer.dll : fatal error LNK1120: 1 unresolved externals
|
Вот код библиотеки: Код | .586P .model flat, stdcall includelib masm32/lib/user32.lib includelib masm32/lib/kernel32.lib
extern MessageBoxA@16:near dll_process_detach equ 0 dll_process_attach equ 1 dll_thread_attach equ 2 dll_thread_detach equ 3
data segment MesOfDll db 'Сообщение',0 TextLoadDll db 'Загрузка библиотеки',0 TextCloseDll db 'Закрытие библиотеки',0 TextProc db 'Процедура в библиотеке',0 data ends code segment startcode: DllEnter: mov eax, dword ptr [ebp+0ch] cmp eax,0 jne Next push 0 push offset MesOfDll push offset TextCloseDll push 0 call MessageBoxA@16 Next: cmp eax,1 jne ExitDll push 0 push offset MesOfDll push offset TextLoadDll push 0 call MessageBoxA@16 ExitDll: mov eax,1 ret 12 ProcDll proc export push ebp mov ebp,esp cmp dword ptr [ebp+8],1 jne ExitDllProc push 0 push offset MesOfDll push offset TextProc push 0 call MessageBoxA@16 ExitDllProc: pop ebp ret 4 ProcDll endp
code ends end startcode
|
Ивот код самой программы на всякий случай, хотя она линкуется нормально Код | .586P .model flat, stdcall include include.inc includelib masm32/lib/user32.lib includelib masm32/lib/kernel32.lib includelib masm32/lib/gdi32.lib data segment LibName db 'SocketServer.dll',0 ErrLibMes db 'Сообщение',0 ErrLibText db 'Ошибка загрузки библиотеки',0 HwndLib dd ? ProcName db 'ProcDll@0',0 data ends code segment startcode: push offset LibName call LoadLibraryA@4 cmp eax,0 je ErrorLib mov HwndLib,eax push offset ProcName push HwndLib call GetProcAddress@8 cmp eax,0 jne ExitProg ErrorLib: push 0 push offset ErrLibMes push offset ErrLibText push 0 call MessageBoxA@16 jmp ExitProg ExitProg: push 0 call ExitProcess@4 code ends end startcode
|
Компилирую вот так Код | @echo off masm32\bin/ml.exe /c /coff /DMASM LoadDll.asm masm32\bin/link.exe /subsystem:windows LoadDll.obj masm32\bin/ml.exe /c /coff /DMASM SocketServer.asm masm32\bin/link.exe /subsystem:windows /DLL /ENTRY:DLLENTRY SocketServer.obj pause>nul
|
Это сообщение отредактировал(а) gwest - 22.10.2007, 17:01
|