Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8971941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:05:22+00:00 2026-06-15T18:05:22+00:00

I compiled a native DLL file on Windows (64-bit) with GCC flags -c and

  • 0

I compiled a native DLL file on Windows (64-bit) with GCC flags -c and -o Name.dll.

When I did System.load(“fullpahhere”), I get this error:

java.lang.UnsatisfiedLinkError: RenderControl.dll: %1 is not a valid Win32 application

If I recompile adding a blank main() method to the C source and removing the -c flag, it then fails with an UnsatisfiedLinkError that says it can’t load a 32 bit DLL on a 64 bit machine.

Why is Java calling a DLL with no main method invalid? Doesn’t that ruin the whole point of DLL files and the JNI?

Update

I fixed the main() issue. This GCC invocation setup works:

gcc -Wall -D_JNI_IMPLEMENTATION_ -Wl,--kill-at -I "C:\Program Files\Java\jdk1.6.0_32\include" -I "C:\Program Files\Java\jdk1.6.0_32\include\win32" -shared *.c -o lib.dll

I still need to figure out the JVM Architecture problem, however.

Where can I find a MinGW installation that is capable of compilnig 64 bit code? It seems my standard MinGW install only does 32 bit.

If I can get my hands on that, how do I decide which library to load in Java? Is there a System property that shows the JVM arch (NOT the OS arch)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T18:05:24+00:00Added an answer on June 15, 2026 at 6:05 pm

    If you use the MinGW32 compiler, you cannot produce 64-bit code. This is something that is most likely intentional. Similar issues with other people I quickly looked up seem to suggest that you’re trying to use a 32-bit native binary with 64-bit java.

    Try compiling with mingw-w64 and see if that allays the problem.

    There’s also the possibility that your library simply isn’t in the library path and that it’s not being found even though you’re giving System.load the full path, in which case you should make sure that your DLL is in the correct location for native libraries.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to load a mixed managed/native dll, which I compiled for 32 bit
I wrote a wrapper DLL for some native c++ functions and compiled it in
I had the 32 bit dll which is written using Native C, when I
I created a native addon for node, a 64bit dll, compiled with the /clr
I've got a native C++ project with one C++/CLI file (the only file compiled
We have a big C++ project that's compiled as native unmanaged code. We need
I compiled the following program with gcc -fprofile-arcs -ftest-coverage test.c: int main() { int
I come from a windows w/ visual-studio background for native development and I am
I've got a compiled resource file (.res). I need to read it, in C#,
I'm trying to call a native function from a managed assembly. I've done this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.