How to link with __imp_JAWT_GetAWT ?

  • Emanuel Falkenauer


    I have a perfectly running MinGW 64, excellent work (many thanks!), builds run flawlessly on Win7-64, inluding pthreads (excellent!) and JNI calls.
    Now however I have run into a problem: trying to use the JAWT functionality to draw in C++ onto a Java canvas, I need to call JAWT_GetAWT (declared in jawt.h), and dllwrap tells me
    undefined reference to `__imp_JAWT_GetAWT'
    … x86_64-w64-mingw32-dllwrap: x86_64-w64-mingw32-c++ exited with status 1
    Looking around for a good while, I seem to understand I need to link with jawt.dll supplied in
    C:\Program Files\Java\jdk1.6.0_26\jre\bin, but honestly I have no idea how to do that.
    I tried (perhaps naively) to issue
    x86_64-w64-mingw32-dllwrap -enable-auto-import  -add-stdcall-alias -mthreads -O3 -o Oljv2exe.dll gccobjs/Oljv2exeMain.o  -lpthread jawt.dll -mwindows -lwsock32 -lole32
    but __imp_JAWT_GetAWT is still undefined.

    According to what I read elsewheve (I literally spent days on this!), I might need to create an import library for the jawt.dll and link with THAT instead… but again, I don't know how to do that properly.

    In short, I would really appreciate your help with a "simple" problem: how can I supply __imp_JAWT_GetAWT to my link?

    Many thanks in advance for your kind help!


  • Kai Tietz

    Kai Tietz - 2011-09-30


    you need to generate an import-library for this DLL.  You can use here gendef tool for generating a .def file for it and then use dlltool for generating out of it an import-library.  See on our Wiki the FAQ section for some details.
    When you have the import-libary, then just add to final linking command -ljawt.

    Other option is to pass for linking also the jawt.dll as argument.  If you are using gcc's frontend for linking then use something like this: '-Wl,C:/Program\ Files/Java\jdk1.6.0_26/jre/bin/jawt.dll'

    Hope this solves your problem.


  • Emanuel Falkenauer


    Absolutely BRILLIANT, your -W switch works out of the box!

    Thanks so much: without solution to this single AWT stuff, I would have been forced to switch a huge project back to 32 bits!




Log in to post a comment.