using dll in am - Mailing list pgsql-hackers

From David Hoksza
Subject using dll in am
Date
Msg-id 737961084.20060423174831@seznam.cz
Whole thread Raw
Responses Re: using dll in am  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hi, I'm trying to implement my own access method, which uses c++
framework for saving tuples. The framework consists of set of
functions, which are implemented in win32 dll.
All the functions which are desired by PG (ambuild, aminsert, ...) are
implemented and functional. But when I want to use any of the
functions from dll so there's problem when loading the dll in
dynloader. It says that function can't be found (in the time of
loading the dll).
I do following steps:

1. Compiling the dll in Microsoft Visual Studio.
2. Creating the def file (in mingw32):
  impdef rtreewrapper.def rtreewrapper.dll
  which yealds in the folowing def file:

LIBRARY     RTREEWRAPPER.DLL

EXPORTS   f_cRTreeItem_GetSize          = _f_cRTreeItem_GetSize@4                f_cRTreeLeafItem_GetSize      =
_f_cRTreeLeafItem_GetSize@4           f_cRTreeLeafItem_size         = _f_cRTreeLeafItem_size@0               f_header
                  = _f_header@0                            f_header_ComputeNodeSize      = _f_header_ComputeNodeSize@4
         f_header_CreateSpaceDescriptor= _f_header_CreateSpaceDescriptor@12
f_header_GetSpaceDescriptor_GetDimension=_f_header_GetSpaceDescriptor_GetDimension@4
f_header_GetSpaceDescriptor_SetBitSize=_f_header_GetSpaceDescriptor_SetBitSize@12         f_header_SetLeafNodeItemSize
=_f_header_SetLeafNodeItemSize@8         f_header_SetNodeItemSize      = _f_header_SetNodeItemSize@8
f_leafitem1                  = _f_leafitem1@0                         f_leafitem                    = _f_leafitem@4
                    f_leafitem_GetTuple_GetValue_GenerateRandom= _f_leafitem_GetTuple_GetValue_GenerateRandom@8
f_leafitem_Resize            = _f_leafitem_Resize@8                   f_timer                       = _f_timer@0
                    f_timer_Print                 = _f_timer_Print@8                       f_timer_Start
= _f_timer_Start@4                       f_timer_Stop                  = _f_timer_Stop@4                        f_tree
                     = _f_tree@4                              f_tree_Close                  = _f_tree_Close@4
            f_tree_Create                 = _f_tree_Create@16                      f_tree_Find                   =
_f_tree_Find@8                        f_tree_GetQueryStatistics_GetCounter_GetValue=
_f_tree_GetQueryStatistics_GetCounter_GetValue@4        f_tree_GetQueryStatistics_GetCounter_Reset=
_f_tree_GetQueryStatistics_GetCounter_Reset@4        f_tree_Insert                 = _f_tree_Insert@8
   f_tree_PrintInfo              = _f_tree_PrintInfo@4
 

3. Creating the .a file from dll by using:
  dlltool --dllname rtreewrapper.dll --def rtreewrapper.def --output-lib rtreewrapper.a

4. Compiling the whole AM module with makefile containing following line:
  OBJS =       atomrtget.o atomrtree.o atomrtscan.o atomrtcostestimate.o rtreewrapper.a

5. Copy the dll to the bin directory (when I let it in the contrib
directory, where also the libatomrtree.dll file with the AM functions
is, so it writes out, that the modul can't be found, when loading it).

6. When there is "void *header = f_header()" anywhere in the source,
so when trying to load the dll (when I try to create the index), it
writes out, that "function can't be found" (I got czech version, so I'm
not sure, what the message is in english).


Does anybody got any hint, where the problem could be? I really can't
find it:((

Thanks.

David Hoksza  
  



pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: TODO items..
Next
From: Tom Lane
Date:
Subject: Re: using dll in am