New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some functions seem missing in DLL version of library. #643
Comments
I don’t know why those functions are missing from the DLL (I don’t use windows), but _h3ToFaceIjk is defined in src/h3lib/lib/h3Index.c .
… On Aug 18, 2022, at 7:20 PM, Skybuck Flying ***@***.***> wrote:
For example:
_h3ToFaceIjk
Seems to be missing.
I would advise to keep all C implementation code strictly seperated into *.C files and not inside headers !
Headers should only contain prototypes, no source code !
—
Reply to this email directly, view it on GitHub <https://www.google.com/url?q=https://github.com/uber/h3/issues/643&source=gmail-imap&ust=1661480429000000&usg=AOvVaw1rlXtXMgDM8vgwdYX3ZRWD>, or unsubscribe <https://www.google.com/url?q=https://github.com/notifications/unsubscribe-auth/ADDRFIA4RFUH54PRMPVMRYTVZ3VOZANCNFSM567EYTPA&source=gmail-imap&ust=1661480429000000&usg=AOvVaw0b9DtWHJyJlC6Z0yafC6VK>.
You are receiving this because you are subscribed to this thread.
|
I think this is a Windows specific issue where only explicitly exported functions (see h3api.h.in line 44) will be visible outside the DLL. Could you try configuring the project with |
I will try this in a moment, but first I will post my own temporarely/experimental fix which I tried/did before reading your comment, my temporarely/experimental fix is as follows: My experimental fix was to basically modify the file: h3api.h.in which seems to be used to generate file: h3api.h The modification adds the missing export for: _h3ToFaceIjk and it also adds the missing structures that are referenced by this api/function call: CoordIJK However doing so would lead to a re-declaration error or warning so these were copied & pasted and then renamed to: CoordIJKv2 For the exporting of this routine it doesn't matter what the name of the structure as as long as it uses the same kind of structures and sizes, so that's why I thought it would work and it did work. Later CHET was used to convert the C headers into Delphi headers, for this to work the structures have to use the original names to avoid some kind of error, to get CHET working I "nuked" the original structures by disabling them in their own header files and kept the structures in the h3api.h file as to prevent a re-declaration error, since CHET seems to use some CLang libary and this CLang library would detect it otherwise and also error on it, so this fixed it. Then I tested the loading in Delphi, I did notice the function api appeared twice in the output/api/h3api.pas file and I simply removed one of them, and it worked, the function seems to perform quite nicely ! I think CHET actually sees all the exported functions somehow... but the actual C build does not somehow... Personally I think the export directive is simply missing, maybe it was intentional because maybe the original author wanted to rename this function first ? Or maybe he/she thought it might not be important ? Or it could simply be looked over because it was in between other internal functions. I believe this last hypothesis might explain why this function is missing, however other functions are also missing... so maybe this is not it. The function is present in the file h3Index.h at the bottom of the file in between other internal functions:
So this is what led to my hypothesis that it may have been missed, because it was in between these internal functions ? However this does not explain why other functions from other files are missing, so maybe there are export directives elsewhere for these functions, so I will try your suggestion and see if that fixes it. So far the commands I used to build with CMake were: Step 1. use CMakeGUI to configure and generate a build folder (not sure if this step is required). Step 2: Configure for DLL release: Step 3: Build DLL release: I will try and integrate your suggestion into these commands, not sure at which step to integrate, step 2 seems most likely to me: cmake ..\h3 -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=ON -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON I will report back later. For now here is my own custom/temporarely/experimental fix that I used to produce a working release DLL with this particular function/api exported:
|
Reporting back on your suggestion: (Not sure if the missing doxygen has anything to do with it, see output below) So far it's building executables and such, I will report back once it's done and I know more ! ;)
|
Your suggested command WORKED ! =D: cmake ..\h3 -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=ON -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON I LOVE YOU RIGHT NOW, IT HAS APPERENTLY/ACCORDING TO TDUMP, EXPORTED ALL FUNCTIONS ! YEAH ! =D Here is the output of TDUMP from Delphi:
|
So far I have been using these two commands: Step 2: Configure for DLL release: Step 3: But something isn't quite right... it dumps the builds/outputs into the main folder... though it would be nice if the output would go to But I am not sure how to modify the above commands ? So basically there are two folders: The git clone into and the intended output/builder folder: Any ideas how to modify the above commands so that it can output to h3v4-build ? I am also not sure if I should then issue the CMake commands in the original folder: h3v4 or in h3v4-build ? Or maybe it does not matter ??? |
If you have already built the library from the main folder you may need to clean your git state ( Alternately try adding |
For example:
_h3ToFaceIjk
Seems to be missing.
I would advise to keep all C implementation code strictly seperated into *.C files and not inside headers !
Headers should only contain prototypes, no source code !
Here is a listing of for example a debug dll build of this library:
Turbo Dump Version 6.5.4.0 Copyright (c) 1988-2016 Embarcadero Technologies, Inc.
Display of File h3.dll
Old Executable Header
DOS File Size 2F000h (192512. )
Load Image Size 450h ( 1104. )
Relocation Table entry count 0000h ( 0. )
Relocation Table address 0040h ( 64. )
Size of header record (in paragraphs) 0004h ( 4. )
Minimum Memory Requirement (in paragraphs) 0000h ( 0. )
Maximum Memory Requirement (in paragraphs) FFFFh ( 65535. )
File load checksum 0000h ( 0. )
Overlay Number 0000h ( 0. )
Initial Stack Segment (SS:SP) 0000:00B8
Program Entry Point (CS:IP) 0000:0000
Portable Executable (PE) File
Header base: 00000100
CPU type AMD64
Flags 2022 [ executable linenumbers symbols largeaddr backwards library ]
DLL flags 0160 [ DynamicBase NXCompat ]
Linker Version E.1D
Time stamp 62E650BF : Sun Jul 31 11:51:59 2022
O/S Version 6.0
User Version 0.0
Subsystem Version 6.0
Subsystem 0003 [ Windows character ]
Object count 00000008
Symbols offset 00000000
Symbols count 00000000
Optional header size 00F0
Magic # 20B
Code size 0001BA00
Init Data size 00013A00
Uninit Data size 00000000
Entry RVA 0000100F
Image base 0000000180000000
Code base 00001000
Object/File align 00001000/00000200
Reserved 00000000
Image size 00034000
Header size 00000400
Checksum 00000000
Stack reserve/commit 0000000000100000/0000000000001000
Heap reserve/commit 0000000000100000/0000000000001000
Number interesting RVAs 00000010
Name RVA Size
Exports 0002B4E0 00000A75
Imports 00030400 00000050
Resources 00032000 0000043C
Exceptions 0002E000 00000EC4
Security 00000000 00000000
Fixups 00033000 000002C8
Debug 000292C8 00000038
Description 00000000 00000000
Global Ptr 00000000 00000000
TLS 00000000 00000000
Callbacks 00029300 00000138
Bound Imports 00000000 00000000
Import Addr Table 00030000 00000400
Delayed Imports 00000000 00000000
COM Runtime 00000000 00000000
reserved 00000000 00000000
Object table:
Name VirtSize RVA PhysSize Phys off Flags
01 .text 0001B9C1 00001000 0001BA00 00000400 60000020 [CER]
02 .rdata 0000EF55 0001D000 0000F000 0001BE00 40000040 [IR]
03 .data 00001809 0002C000 00001200 0002AE00 C0000040 [IRW]
04 .pdata 00001164 0002E000 00001200 0002C000 40000040 [IR]
05 .idata 00000F82 00030000 00001000 0002D200 40000040 [IR]
06 .00cfg 00000151 00031000 00000200 0002E200 40000040 [IR]
07 .rsrc 0000043C 00032000 00000600 0002E400 40000040 [IR]
08 .reloc 00000566 00033000 00000600 0002EA00 42000040 [DIR]
Key to section flags:
C - contains code
D - discardable
E - executable
I - contains initialized data
R - readable
W - writeable
Section: Import
File Offset: 0002D200 (184832)
ImportLookUpTblRVA:000305A8
Time Stamp: 00000000
Forwarder Chain: 00000000 (index of first forwarder reference)
Imports from VCRUNTIME140D.dll
(hint = 002F) __vcrt_GetModuleHandleW
(hint = 002E) __vcrt_GetModuleFileNameW
(hint = 001C) __current_exception_context
(hint = 001B) __current_exception
(hint = 0025) __std_type_info_destroy_list
(hint = 0009) __C_specific_handler_noexcept
(hint = 0008) __C_specific_handler
(hint = 003C) memcpy
(hint = 0031) __vcrt_LoadLibraryExW
(hint = 003E) memset
Imports from ucrtbased.dll
(hint = 0528) strcat_s
(hint = 0068) __stdio_common_vsprintf_s
(hint = 0175) _initterm_e
(hint = 00B6) _configure_narrow_argv
(hint = 0171) _initialize_narrow_environment
(hint = 0172) _initialize_onexit_table
(hint = 02B5) _register_onexit_function
(hint = 00E5) _execute_onexit_table
(hint = 00C2) _crt_atexit
(hint = 00C1) _crt_at_quick_exit
(hint = 00A4) _cexit
(hint = 054B) terminate
(hint = 039C) _wmakepath_s
(hint = 03B8) _wsplitpath_s
(hint = 0564) wcscpy_s
(hint = 052C) strcpy_s
(hint = 0174) _initterm
(hint = 0005) _CrtDbgReportW
(hint = 0004) _CrtDbgReport
(hint = 03D8) acos
(hint = 04F8) pow
(hint = 047A) fmod
(hint = 0547) tan
(hint = 03E5) atan2
(hint = 03E4) atan
(hint = 03DF) asin
(hint = 0512) round
(hint = 0342) _wassert
(hint = 0520) sin
(hint = 042D) cos
(hint = 0524) sqrt
(hint = 00C9) _dclass
(hint = 0069) __stdio_common_vsscanf
(hint = 0066) __stdio_common_vsprintf
(hint = 0477) fmin
(hint = 0416) ceil
(hint = 04D7) lroundl
(hint = 0459) fabs
(hint = 03D7) abs
(hint = 04D8) malloc
(hint = 0484) free
(hint = 03FD) calloc
(hint = 02C2) _seh_filter_dll
Imports from KERNEL32.dll
(hint = 02DA) GetStartupInfoW
(hint = 0468) RaiseException
(hint = 03F6) MultiByteToWideChar
(hint = 0611) WideCharToMultiByte
(hint = 04D5) RtlCaptureContext
(hint = 04DC) RtlLookupFunctionEntry
(hint = 04E3) RtlVirtualUnwind
(hint = 05C0) UnhandledExceptionFilter
(hint = 057F) SetUnhandledExceptionFilter
(hint = 0220) GetCurrentProcess
(hint = 02B8) GetProcAddress
(hint = 01B4) FreeLibrary
(hint = 05E1) VirtualQuery
(hint = 02BE) GetProcessHeap
(hint = 0355) HeapFree
(hint = 0351) HeapAlloc
(hint = 026A) GetLastError
(hint = 0281) GetModuleHandleW
(hint = 0385) IsDebuggerPresent
(hint = 036F) InitializeSListHead
(hint = 0125) DisableThreadLibraryCalls
(hint = 02F3) GetSystemTimeAsFileTime
(hint = 0225) GetCurrentThreadId
(hint = 0221) GetCurrentProcessId
(hint = 0452) QueryPerformanceCounter
(hint = 038C) IsProcessorFeaturePresent
(hint = 059E) TerminateProcess
Section: Exports
File Offset: 0001BE00 (114176)
Flags: 00000000
Time Stamp: FFFFFFFF : Thu Jan 1 00:59:59 1970
Major Version: 0000
Minor Version: 0000
Exports from h3.dll
74 exported name(s), 74 export addresse(s). Ordinal base is 1.
Sorted by Name:
RVA Ord. Hint Name
-------- ---- ---- ----
00001091 1 0000 _zeroIndexDigits
0000115E 2 0001 areNeighborCells
00001375 3 0002 cellAreaKm2
000015DC 4 0003 cellAreaM2
000014E2 5 0004 cellAreaRads2
00001519 6 0005 cellToBoundary
00001500 7 0006 cellToCenterChild
000011EA 8 0007 cellToChildren
0000105F 9 0008 cellToChildrenSize
00001587 10 0009 cellToLatLng
00001203 11 000A cellToLocalIj
00001573 12 000B cellToParent
00001307 13 000C cellToVertex
000010D2 14 000D cellToVertexes
00001465 15 000E cellsToDirectedEdge
00001438 16 000F cellsToLinkedMultiPolygon
0000100A 17 0010 compactCells
000015BE 18 0011 degsToRads
000014B5 19 0012 destroyLinkedMultiPolygon
000012B7 20 0013 directedEdgeToBoundary
00001258 21 0014 directedEdgeToCells
00001032 22 0015 exactEdgeLengthKm
00001014 23 0016 exactEdgeLengthM
000010D7 24 0017 exactEdgeLengthRads
0000103C 25 0018 getBaseCellNumber
0000120D 26 0019 getDirectedEdgeDestination
000011EF 27 001A getDirectedEdgeOrigin
00001370 28 001B getHexagonAreaAvgKm2
000012AD 29 001C getHexagonAreaAvgM2
00001217 30 001D getHexagonEdgeLengthAvgKm
000010E6 31 001E getHexagonEdgeLengthAvgM
000015B9 32 001F getIcosahedronFaces
00001280 33 0020 getNumCells
000014BF 34 0021 getPentagons
00001343 35 0022 getRes0Cells
000015AA 36 0023 getResolution
0000113B 37 0024 greatCircleDistanceKm
000012A8 38 0025 greatCircleDistanceM
0000117C 39 0026 greatCircleDistanceRads
0000159B 40 0027 gridDisk
00001122 41 0028 gridDiskDistances
0000141F 42 0029 gridDiskDistancesSafe
000011F4 43 002A gridDiskDistancesUnsafe
00001334 44 002B gridDiskUnsafe
0000153C 45 002C gridDisksUnsafe
000012E4 46 002D gridDistance
0000149C 47 002E gridPathCells
000011E0 48 002F gridPathCellsSize
0000121C 49 0030 gridRingUnsafe
00001505 50 0031 h3ToString
00001140 51 0032 isPentagon
00001262 52 0033 isResClassIII
0000106E 53 0034 isValidCell
00001582 54 0035 isValidDirectedEdge
0000155F 55 0036 isValidVertex
0000129E 56 0037 iterInitBaseCellNum
000013BB 57 0038 iterInitParent
00001532 58 0039 iterInitRes
000013C0 59 003A iterStepChild
0000123A 60 003B iterStepRes
000013CA 61 003C latLngToCell
000010AA 62 003D localIjToCell
0000139D 63 003E maxFaceCount
0000105A 64 003F maxGridDiskSize
000014D3 65 0040 maxPolygonToCellsSize
00001546 66 0041 originToDirectedEdges
0000111D 67 0042 pentagonCount
00001514 68 0043 polygonToCells
00001104 69 0044 radsToDegs
00001389 70 0045 res0CellCount
000012E9 71 0046 stringToH3
000014FB 72 0047 uncompactCells
00001433 73 0048 uncompactCellsSize
0000126C 74 0049 vertexToLatLng
Section: Resources
File Offset: 0002E400 (189440)
Flags: 00000000
Time Stamp: 00000000
Major Version: 0000
Minor Version: 0000
Resources:
Type Name Lang Id
[0 named entries, 1 ID entries]
type: Manifest (24) (next directory @00000018)
The text was updated successfully, but these errors were encountered: