AnswerBun.com

Haskell не экспортируется функция при создании dll

Stack Overflow на русском Asked on November 29, 2020

Пишу код на Haskell и компилирую в библиотеку dll, после этого, с помощью утилиты dumpbin просматриваю таблицу командой dumpbin /IMPORTS Foo.dll. Название экспортируемой функции "adder".

Вывод:

File Type: DLL

  Section contains the following imports:

    dbghelp.dll
              62D9986C Import Address Table
              62D9908C Import Name Table
                     0 time date stamp
                     0 Index of first forwarder reference

                          59 SymFromAddr
                          6A SymGetLineFromAddr64

    KERNEL32.dll
              62D99884 Import Address Table
              62D990A4 Import Name Table
                     0 time date stamp
                     0 Index of first forwarder reference

                          8D CloseHandle
                          C5 CreateEventA
                          D4 CreateFileW
                          FC CreateThread
                         103 CreateTimerQueue
                         104 CreateTimerQueueTimer
                         11B DeleteCriticalSection
                         120 DeleteFileW
                         124 DeleteTimerQueueEx
                         125 DeleteTimerQueueTimer
                         13F EnterCriticalSection
                         16F ExitThread
                         196 FindFirstVolumeW
                         1A1 FindNextVolumeW
                         1A8 FindVolumeClose
                         1AE FlushConsoleInputBuffer
                         1B6 FormatMessageA
                         1B7 FormatMessageW
                         1B9 FreeEnvironmentStringsA
                         1C2 GetACP
                         1D0 GetBinaryTypeW
                         1D2 GetCPInfo
                         1E8 GetCommandLineW
                         1FB GetConsoleCP
                         20D GetConsoleMode
                         228 GetCurrentProcess
                         229 GetCurrentProcessId
                         22C GetCurrentThread
                         22D GetCurrentThreadId
                         23B GetDiskFreeSpaceExW
                         249 GetEnvironmentStrings
                         24D GetEnvironmentVariableW
                         251 GetExitCodeThread
                         256 GetFileAttributesA
                         258 GetFileAttributesExW
                         25D GetFileInformationByHandle
                         262 GetFileSizeEx
                         264 GetFileType
                         26F GetFullPathNameW
                         276 GetLastError
                         284 GetLongPathNameW
                         28A GetModuleFileNameW
                         28B GetModuleHandleA
                         28E GetModuleHandleW
                         2A1 GetNumaHighestNodeNumber
                         2A3 GetNumaNodeProcessorMask
                         2C6 GetProcAddress
                         2C7 GetProcessAffinityMask
                         2D6 GetProcessTimes
                         2FB GetSystemInfo
                         2FF GetSystemTime
                         301 GetSystemTimeAsFileTime
                         30C GetTempFileNameW
                         31D GetThreadTimes
                         31F GetTickCount
                         338 GetVolumeInformationW
                         354 GlobalMemoryStatusEx
                         35F HeapAlloc
                         361 HeapCreate
                         363 HeapDestroy
                         365 HeapFree
                         36A HeapSetInformation
                         37C InitializeCriticalSection
                         37D InitializeCriticalSectionAndSpinCount
                         397 IsDBCSLeadByteEx
                         3B2 K32EnumProcessModules
                         3BE K32GetModuleFileNameExW
                         3BF K32GetModuleInformation
                         3D8 LeaveCriticalSection
                         3DE LoadLibraryExW
                         3DF LoadLibraryW
                         3EA LocalFree
                         405 MoveFileExW
                         408 MoveFileW
                         40C MultiByteToWideChar
                         433 OpenThread
                         436 OutputDebugStringA
                         43E PeekConsoleInputA
                         440 PeekNamedPipe
                         45B PulseEvent
                         46B QueryPerformanceCounter
                         46C QueryPerformanceFrequency
                         486 ReadConsoleInputA
                         4BE ResetEvent
                         4C6 RtlAddFunctionTable
                         4C7 RtlCaptureContext
                         4CE RtlLookupFunctionEntry
                         4D5 RtlVirtualUnwind
                         4DA SearchPathW
                         4ED SetConsoleCtrlHandler
                         4FD SetConsoleMode
                         514 SetEndOfFile
                         518 SetEnvironmentVariableW
                         51A SetEvent
                         527 SetFilePointer
                         536 SetLastError
                         557 SetThreadAffinityMask
                         572 SetUnhandledExceptionFilter
                         582 Sleep
                         58C SwitchToThread
                         58D SystemTimeToFileTime
                         591 TerminateProcess
                         5A3 TlsAlloc
                         5A4 TlsFree
                         5A5 TlsGetValue
                         5A6 TlsSetValue
                         5AC TryEnterCriticalSection
                         5B3 UnhandledExceptionFilter
                         5CE VirtualAlloc
                         5D1 VirtualFree
                         5D4 VirtualProtect
                         5D6 VirtualQuery
                         5DF WaitForSingleObject
                         60E WideCharToMultiByte

    msvcrt.dll
              62D99C1C Import Address Table
              62D9943C Import Name Table
                     0 time date stamp
                     0 Index of first forwarder reference

                          40 ___lc_codepage_func
                          43 ___mb_cur_max_func
                          54 __iob_func
                          63 __setusermatherr
                          76 _access
                          7B _amsg_exit
                          7C _assert
                          89 _beginthreadex
                          9F _close
                          95 _chmod
                          A8 _creat
                          B0 _ctime64
                          D9 _dup
                          C3 _dup2
                          C9 _environ
                          CC _errno
                          EB _fileno
                         103 _fpreset
                         112 _fstat64
                         128 _get_osfhandle
                         142 _getpid
                         14F _initterm
                         155 _isatty
                         153 _isatty
                         1BC _lock
                         1C7 _lseeki64
                         263 _mkdir
                         26A _open_osfhandle
                         271 _pipe
                         285 _read
                         2A4 _setmode
                         2E1 _strdup
                         318 _telli64
                         31B _time64
                         336 _unlock
                         33A _umask
                         33C _utime64
                         35F _vsnwprintf
                         37B _wcsdup
                         37A _wcsdup
                         3B6 _wfdopen
                         335 _unlink
                         3E1 _write
                         3F4 _wsplitpath_s
                         3F5 _wstat
                         3F7 _wstat64
                         411 abort
                         413 acos
                         414 acosf
                         416 asin
                         417 asinf
                         418 atan
                         41B atanf
                         41D atof
                         41E atoi
                         420 bsearch
                         422 calloc
                         428 cos
                         429 cosf
                         42A cosh
                         42B coshf
                         42F exit
                         430 exp
                         431 expf
                         433 fclose
                         434 feof
                         436 fflush
                         442 fprintf
                         444 fputc
                         446 fputwc
                         448 fread
                         449 free
                         44F fseek
                         451 ftell
                         452 fwprintf
                         455 fwrite
                         458 getc
                         45A getenv
                         467 islower
                         46A isspace
                         46B isupper
                         47B ldexp
                         47D localeconv
                         47F log
                         482 logf
                         484 malloc
                         487 mbstowcs
                         48A memchr
                         48B memcmp
                         48C memcpy
                         48D memmove
                         48E memset
                         493 pow
                         494 powf
                         49C qsort
                         49E raise
                         4A0 realloc
                         4A8 setlocale
                         4AA signal
                         4AB sin
                         4AC sinf
                         4AD sinh
                         4AE sinhf
                         4B8 strcmp
                         4BA strcpy
                         4BD strerror
                         4BF strlen
                         4C2 strncmp
                         4C3 strncpy
                         4C6 strrchr
                         4C8 strstr
                         4CB strtok
                         4CD strtol
                         4D1 swprintf_s
                         4D5 tan
                         4D6 tanf
                         4D7 tanh
                         4E2 vfprintf
                         4EE wcscat
                         4F1 wcscmp
                         4F3 wcscpy
                         4F7 wcslen
                         4FA wcsncmp
                         4FD wcsnlen

    SHELL32.dll
              62D9A004 Import Address Table
              62D99824 Import Name Table
                     0 time date stamp
                     0 Index of first forwarder reference

                           B CommandLineToArgvW

    USER32.dll
              62D9A014 Import Address Table
              62D99834 Import Name Table
                     0 time date stamp
                     0 Index of first forwarder reference

                         265 MessageBoxA

    WSOCK32.dll
              62D9A024 Import Address Table
              62D99844 Import Name Table
                     0 time date stamp
                     0 Index of first forwarder reference

                          28 closesocket
                          40 recv
                          45 select
                          46 send

  Summary

        1000 .CRT
        2000 .bss
      14A000 .data
       20000 .debug_abbrev
        6000 .debug_aranges
       10000 .debug_frame
      44B000 .debug_info
       69000 .debug_line
       D6000 .debug_loc
       2A000 .debug_ranges
        9000 .debug_str
      26E000 .edata
        3000 .idata
        5000 .pdata
       4D000 .rdata
       5B000 .reloc
      387000 .text
        1000 .tls
        5000 .xdata

В этой таблице я не нашел упоминания этой функции. Может быть проблема в коде или способе компиляции?

Код программы:

{- # LANGUAGE ForeignFunctionInterface # -}
module Foo where

import Foreign.C.Types

foreign export ccall
    adder :: CInt -> CInt -> IO CInt

adder :: CInt -> CInt -> IO CInt
adder x y = return (x+y)

Команда для компиляции:

ghc -O2 —make -no-hs-main -optl -shared -o Foo.dll Foo.hs

Add your own answers!

Related Questions

Замена надписей в v-date-picker на Vuetify JS

1  Asked on December 21, 2020 by andrew-volikov

     

Умножить элементы массива

2  Asked on December 20, 2020 by babakov-roman678

 

Скрипт не видит rigidbody

1  Asked on December 19, 2020 by mirlin

   

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir