Results 1 to 4 of 4

Thread: Works on 64bit doesn't on 32 bit

  1. #1
    Join Date
    Jun 2013
    Posts
    3
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Works on 64bit doesn't on 32 bit

    Hi everyone,
    i'm developing with qt by 6 months.
    i've just developed a dll under windows using qt creator 2.7.0 with qt 5.02 compiling with MinGW 4.7 32bit and then i link it in vb.net project with a wrapper made in c#.
    The library use stcall to face the functions to the wrapper and my application goes fine on 64bit operating system (windows 7 and windows 8 tested)
    if i run my application under windows xp 32bit operating systems i receive the following error:


    System.DllNotFoundException: Unable to load DLL 'QTRender.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
    at dmg.renderImport.DllInterface.DrawTextGiottoFix(By te[] c, Int32& width, Int32& height, Single& fontSize, Int32 letterSpacing, Int32 wordSpacing, Int32 fontWeight, Byte[] Testo, Int32 lenTesto, Byte[] fontName, Int32 lenFontName, Int32 Rfore, Int32 Gfore, Int32 Bfore, Int32 Afore, Int32 Rshadow, Int32 Gshadow, Int32 Bshadow, Int32 Ashadow, QthAlign hAlign, QtvAlign vAlign)
    at QTRenderWrapper.Wrapper.DrawImageFix(String Testo, Int32& width, Int32& height, Single& fontSize, Int32 letterSpacing, Int32 wordSpacing, Int32 fontWeight, String Fontname, Int32 lenFontName, Int32 Rfore, Int32 Gfore, Int32 Bfore, Int32 Afore, Int32 Rshadow, Int32 Gshadow, Int32 Bshadow, Int32 Ashadow, QthAlign hAlign, QtvAlign vAlign)

    i can't understand why, it's almost a month i'm crashing my head upon this!
    please someone could help me?
    tell me if you need other details.

    thank you

  2. #2
    Join Date
    Feb 2012
    Location
    Armenia/Yerevan
    Posts
    400
    Thanks
    15
    Thanked 16 Times in 15 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: Works on 64bit doesn't on 32 bit

    Since C# programs run in AnyCPU mode, it automatically loads 64 bit dlls under 64 bit OS and 32 bit dlls under 32 bit OS.

    Compile the DLL with a 32 bit compiler and put 32 QT Dlls with it.

  3. #3
    Join Date
    Jun 2013
    Posts
    3
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Works on 64bit doesn't on 32 bit

    Hi Saman,
    thank you for your answer, i've not been at work so i didn't read your reply.
    Compiling with a 32 bit compiler is what i've done for first, i'm using Qt 5.0.2 MinGW 32bit
    I don't understand from your reply if i have to put in my application folder both the 32 and 64 bit compiled dll.
    Do i need two versions of the same library?
    I thought about some type conversions of the parameter i'm passing to the library but i'm using only pointers, int and chars. I don't know where it could be fail.
    Follow parts of my code
    QTR.pro
    Qt Code:
    1. #-------------------------------------------------
    2. #
    3. # Project created by QtCreator 2012-11-13T11:23:02
    4. #
    5. #-------------------------------------------------
    6.  
    7. TARGET = QTR
    8. TEMPLATE = lib
    9. QMAKE_CFLAGS += /Gz QMAKE_CXXFLAGS += /Gz
    10. DEFINES += QTR_LIBRARY
    11.  
    12. SOURCES += qtr.cpp
    13.  
    14. HEADERS += qtr.h\
    15. QTR_global.h
    16.  
    17. symbian {
    18. MMP_RULES += EXPORTUNFROZEN
    19. TARGET.UID3 = 0xE3A9118A
    20. TARGET.CAPABILITY =
    21. TARGET.EPOCALLOWDLLDATA = 1
    22. addFiles.sources = QTR.dll
    23. addFiles.path = !:/sys/bin
    24. DEPLOYMENT += addFiles
    25. }
    26.  
    27. unix:!symbian {
    28. maemo5 {
    29. target.path = /opt/usr/lib
    30. } else {
    31. target.path = /usr/lib
    32. }
    33. INSTALLS += target
    34. }
    35.  
    36. CONFIG += QwtDll
    37.  
    38.  
    39. win32 {
    40. QMAKE_LFLAGS += -static-libgcc
    41. }
    To copy to clipboard, switch view to plain text mode 

    header file

    Qt Code:
    1. #-------------------------------------------------
    2. #
    3. # Project created by QtCreator 2012-11-13T11:23:02
    4. #
    5. #-------------------------------------------------
    6.  
    7. TARGET = QTR
    8. TEMPLATE = lib
    9. QMAKE_CFLAGS += /Gz QMAKE_CXXFLAGS += /Gz
    10. DEFINES += QTR_LIBRARY
    11.  
    12. SOURCES += qtr.cpp
    13.  
    14. HEADERS += qtr.h\
    15. QTR_global.h
    16.  
    17. symbian {
    18. MMP_RULES += EXPORTUNFROZEN
    19. TARGET.UID3 = 0xE3A9118A
    20. TARGET.CAPABILITY =
    21. TARGET.EPOCALLOWDLLDATA = 1
    22. addFiles.sources = QTR.dll
    23. addFiles.path = !:/sys/bin
    24. DEPLOYMENT += addFiles
    25. }
    26.  
    27. unix:!symbian {
    28. maemo5 {
    29. target.path = /opt/usr/lib
    30. } else {
    31. target.path = /usr/lib
    32. }
    33. INSTALLS += target
    34. }
    35.  
    36. CONFIG += QwtDll
    37.  
    38.  
    39. win32 {
    40. QMAKE_LFLAGS += -static-libgcc
    41. }
    To copy to clipboard, switch view to plain text mode 

    can anybody help?
    thank you in advance
    daniel

  4. #4
    Join Date
    Jun 2013
    Posts
    3
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Works on 64bit doesn't on 32 bit

    Hi
    posting again some news about my tests.
    The only machine where i can't use this dll is Windows XP on 32 bit processors.
    I can't understand why this happens.
    following my c# wrapper code



    thank you in adavance to anybody could help me
    Qt Code:
    1. public class DllInterface
    2. {
    3. [DllImport(@"QTRender.dll", EntryPoint = "??0QTRender@@QAE@XZ")]
    4. public static extern int Init();
    5. [DllImport(@"QTRender.dll", CallingConvention = CallingConvention.StdCall)]
    6. public static extern int DrawTextGiotto([Out] byte[] c, [In][Out] ref int width, [In][Out] ref int height, [In][Out] ref float fontSize, int letterSpacing, int wordSpacing, int fontWeight, [In] byte[] Testo, int lenTesto, [In] byte[] fontName, int lenFontName, int Rfore, int Gfore, int Bfore, int Afore, int Rshadow, int Gshadow, int Bshadow, int Ashadow, QthAlign hAlign, QtvAlign vAlign);
    7.  
    8. [DllImport(@"QTRender.dll", CallingConvention = CallingConvention.StdCall)]
    9. public static extern int DrawTextInSquare([Out] byte[] c, [In][Out] ref int width, [In][Out] ref int height, [In][Out] ref float fontSize, int letterSpacing, int wordSpacing, int fontWeight, [In] byte[] Testo, int lenTesto, [In] byte[] fontName, int lenFontName, int Rfore, int Gfore, int Bfore, int Afore, int Rshadow, int Gshadow, int Bshadow, int Ashadow, QthAlign hAlign, QtvAlign vAlign);
    10.  
    11. [DllImport(@"QTRender.dll", CallingConvention = CallingConvention.StdCall)]
    12. public static extern int DrawTextGiottoFix([Out] byte[] c, [In][Out] ref int width, [In][Out] ref int height, [In][Out] ref float fontSize, int letterSpacing, int wordSpacing, int fontWeight, [In] byte[] Testo, int lenTesto, [In] byte[] fontName, int lenFontName, int Rfore, int Gfore, int Bfore, int Afore, int Rshadow, int Gshadow, int Bshadow, int Ashadow, QthAlign hAlign, QtvAlign vAlign);
    13. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Building 64bit Shared Qt Dlls on 64bit Win7 for Visual Studio
    By HarrySatt in forum Installation and Deployment
    Replies: 1
    Last Post: 29th November 2011, 05:39
  2. Replies: 3
    Last Post: 6th July 2011, 07:59
  3. Replies: 2
    Last Post: 21st March 2011, 23:00
  4. Replies: 1
    Last Post: 31st December 2010, 17:35
  5. Qt Creator SDK 2010.05 - 'Hallo world' doesn't work on Windows 7 64bit
    By mastupristi in forum Qt Tools
    Replies: 1
    Last Post: 15th November 2010, 10:25

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.