PlanetSquires Forums

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 [2]

Author Topic: MakeLIB - utility to create (*.a) import library from DLL (source included)  (Read 10249 times)

James Fuller

  • Senior Member
  • ***
  • Posts: 305
  • FF3 User

Jose,
  Try this one.

James
Logged

Josť Roca

  • Guru Member
  • *****
  • Posts: 3282

Thanks very much. Apparently it works. I have called one of the functions and the test compiles and runs. Will have to do a more extensive test.

But what I would like to know is what I have to do to build a library that works, instead of having to beg for it, because there are many that I will need. What have you done? I have used the .def file that you posted an run dlltool. It has created a library, but the linker doesn't like it. Why?

James Fuller

  • Senior Member
  • ***
  • Posts: 305
  • FF3 User

Jose,
  I don't know how you went about it so I will provide my method.
I have always used msys: http://www.mingw.org/wiki/msys for building Mingw compatible libraries.
The rage today is msys2 but it comes with it's own version of gcc/g++ and I never (spent little time) figured out how to tell it to use something else.
With msys I can edit the "msys/1.0/etc/fstab" file  to tell it which compiler/tools to use. You do have to exit and rerun after changing.
Some of the MinGW 64 bit compilers can produce 32bit executables but they are a pain to use with most of the library sources that use "configure" to set up a build of the library. I always install both the 64bit and 32bit versions so I can build 32/64 by changing the fstab entry.

For this specific case I installed both FreeBasic 32/64 along with the recommended Mingw gnu 32/64 toolchains and renamed them FbMingw32/FbMingw64 respectively.
I also have Visual Studio 2015 Community installed.

I downloaded the reimp source and built both 32 and 64 bit versions using FbMingw32/64. This is probably not necessary but... Many warnings on both builds but they both ran fine(?).

Now the search begins to find the propsys.lib files. I found them in two places:
64bit:
C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x64
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib\x64

32bit:
C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x86
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib

I used the ones from the Windows Kits\8.1\.

I created folders for both 32/64 and copied the respective propsys.lib files to them
I also added the 32/64 bit versions of reimp.

I fired up msys and navigated to the folders. Remember to use /c/ for the drive and edit fstab.

$ cd /c/work/propsys32
$ reimp -d propsys.lib
Note the 32/64 def files will differ but the last line in each def file I believe is for use with C##.
_WinRTPropertyValueToPropVariant@8   @436
Delete this last line before running dlltool.

$ dlltool -k -d propsys.def -l libpropsys.a

That's it.:)

James
   


Logged

Josť Roca

  • Guru Member
  • *****
  • Posts: 3282

No, that's not all.

Why if I use dlltool -k -d propsys.def -l libpropsys.a in my computer the resulting library does not work?

Are you using the dlltool.exe that comes with FB or another one?

Josť Roca

  • Guru Member
  • *****
  • Posts: 3282

Code: [Select]
[quote]
Now the search begins to find the propsys.lib files. I found them in two places:
64bit:
C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x64
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib\x64

32bit:
C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x86
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib

In Windows 7 you find the 64 bit one in System32, and the 32 bit one in SysWOW64 (the DLLs, not the LIBs).
« Last Edit: June 13, 2016, 02:24:34 PM by Jose Roca »
Logged

James Fuller

  • Senior Member
  • ***
  • Posts: 305
  • FF3 User

I am using the dlltool from the FbMingw32/64.
The 32bit one creates a 32bit library the 64 a 64 library.

The .lib files are part of the Visual C++ sdk.

James
Logged

Josť Roca

  • Guru Member
  • *****
  • Posts: 3282

> I am using the dlltool from the FbMingw32/64.

And there is a way to get them (both 32 and 64 bit) in binary form, without having to install MinGW, learn C programming and compile the source code?

Apparently, the Linux guys think that everybody has to learn C.

James Fuller

  • Senior Member
  • ***
  • Posts: 305
  • FF3 User

They are included with both 32/64 FreeBasic.
Just make sure you use the right one.
James
Logged

Josť Roca

  • Guru Member
  • *****
  • Posts: 3282

reimp.exe is not included, and the libraries generated with dlltool.exe don't work, at least the ones that I've tried.

But it doesn't matter, I give up.
« Last Edit: June 14, 2016, 04:38:14 AM by Jose Roca »
Logged

Josť Roca

  • Guru Member
  • *****
  • Posts: 3282

I have tried the reimp.exe 32-bit that I have found in the web and it works.

Code: [Select]
reimp -d mCtrl.lib
dlltool -k -d mCtrl.def -l libmCtrl.dll.a

the .def file is different from the one generated by the other tools:

Code: [Select]
LIBRARY "mCtrl.dll"
EXPORTS
DllGetVersion@4
mcBeginBufferedAnimation@32
mcBeginBufferedPaint@20
mcBeginPanningFeedback@4
mcBufferedPaintClear@8
mcBufferedPaintInit@0
mcBufferedPaintRenderAnimation@8
mcBufferedPaintStopAllAnimations@4
mcBufferedPaintUnInit@0
mcButton_Initialize@0
mcButton_Terminate@0
mcChart_Initialize@0
mcChart_Terminate@0
mcCloseThemeData@4
mcCreateDialogIndirectParamA@24
mcCreateDialogIndirectParamW@24
mcCreateDialogParamA@24
mcCreateDialogParamW@24
mcDialogBoxIndirectParamA@24
mcDialogBoxIndirectParamW@24
mcDialogBoxParamA@24
mcDialogBoxParamW@24
mcDrawThemeBackground@24
mcDrawThemeBackgroundEx@24
mcDrawThemeEdge@32
mcDrawThemeIcon@28
mcDrawThemeParentBackground@12
mcDrawThemeParentBackgroundEx@16
mcDrawThemeText@36
mcDrawThemeTextEx@36
mcEnableThemeDialogTexture@8
mcEndBufferedAnimation@8
mcEndBufferedPaint@8
mcEndPanningFeedback@8
mcExpand_Initialize@0
mcExpand_Terminate@0
mcGetBufferedPaintBits@12
mcGetBufferedPaintDC@4
mcGetBufferedPaintTargetDC@4
mcGetBufferedPaintTargetRect@8
mcGetCurrentThemeName@24
mcGetThemeAppProperties@0
mcGetThemeBackgroundContentRect@24
mcGetThemeBackgroundExtent@24
mcGetThemeBackgroundRegion@24
mcGetThemeBitmap@24
mcGetThemeBool@20
mcGetThemeColor@20
mcGetThemeDocumentationProperty@16
mcGetThemeEnumValue@20
mcGetThemeFilename@24
mcGetThemeFont@24
mcGetThemeInt@20
mcGetThemeIntList@20
mcGetThemeMargins@28
mcGetThemeMetric@24
mcGetThemePartSize@28
mcGetThemePosition@20
mcGetThemePropertyOrigin@20
mcGetThemeRect@20
mcGetThemeStream@28
mcGetThemeString@24
mcGetThemeSysBool@8
mcGetThemeSysColor@8
mcGetThemeSysColorBrush@8
mcGetThemeSysFont@12
mcGetThemeSysInt@12
mcGetThemeSysSize@8
mcGetThemeSysString@16
mcGetThemeTextExtent@36
mcGetThemeTextMetrics@20
mcGetThemeTransitionDuration@24
mcGetWindowTheme@4
mcGrid_Initialize@0
mcGrid_Terminate@0
mcHitTestThemeBackground@40
mcHtml_Initialize@0
mcHtml_Terminate@0
mcImgView_Initialize@0
mcImgView_Terminate@0
mcIsAppThemed@0
mcIsCompositionActive@0
mcIsMenubarMessage@8
mcIsThemeActive@0
mcIsThemeBackgroundPartiallyTransparent@12
mcIsThemeDialogTextureEnabled@4
mcIsThemePartDefined@12
mcMditab_DefWindowProc@24
mcMditab_Initialize@0
mcMditab_Terminate@0
mcMenubar_HandleRebarChevronPushed@8
mcMenubar_Initialize@0
mcMenubar_Terminate@0
mcOpenThemeData@8
mcOpenThemeDataEx@12
mcSetThemeAppProperties@4
mcSetWindowTheme@12
mcSetWindowThemeAttribute@16
mcTable_AddRef@4
mcTable_Clear@8
mcTable_ColumnCount@4
mcTable_Create@12
mcTable_GetCellA@16
mcTable_GetCellW@16
mcTable_Release@4
mcTable_Resize@12
mcTable_RowCount@4
mcTable_SetCellA@16
mcTable_SetCellW@16
mcTheme_Initialize@0
mcTheme_Terminate@0
mcTreeList_Initialize@0
mcTreeList_Terminate@0
mcUpdatePanningFeedback@16
mcVersion@4

You would have saved me hours of headaches if you had posted reimp.exe as I requested, instead of the other tools that don't work with these visual basic libraries.

Now I need a reimp.exe for 64 bit.
« Last Edit: June 14, 2016, 07:20:40 AM by Jose Roca »
Logged

James Fuller

  • Senior Member
  • ***
  • Posts: 305
  • FF3 User

I must have missed your request, Sorry.
Attached find 32/64 reimp
James

Logged

Josť Roca

  • Guru Member
  • *****
  • Posts: 3282

Thanks very much. I have got it working.
Pages: 1 [2]