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 9131529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:09:21+00:00 2026-06-17T08:09:21+00:00

Background I am trying to build a Java program that make use of an

  • 0

Background

I am trying to build a Java program that make use of an existing native library via JNI. There are two components of the native project that each build a shared library:

  1. A core component that builds core.lib and core.dll
  2. An application component that depends on the core component, and builds application.lib and application.dll

Using SWIG, I’ve created an application_wrap.c file, and corresponding Java files so that I can use JNI to access the native library.

What I would like to do is build a new shared library (lets call it application_jni.dll) containing this application_wrap.c file, so that I can load it in my Java program like this:

System.loadLibrary("application_jni");

Problem

Unfortunately, I can’t seem to figure out how to do this on Windows using the Visual Studio compiler. Here’s what I’ve tried:

First, compiling the application_wrap.c file generated by SWIG. This produces application_wrap.obj, and seems to work just fine.

cl /I "path/to/core/headers" /I "path/to/application/headers" -c application_wrap.c

Next, linking the application_wrap.obj against the existing shared libraries to create a new shared library:

link /dll /out:application_jni.dll application_wrap.obj core.lib application.lib

This results in a large number of errors that look like this:

application_wrap.obj : error LNK2019: unresolved external symbol __imp__function_in_core referenced in function_in_application_wrap

Any idea what could be causing these errors? I don’t have a lot of experience with compiling on Windows, so I wouldn’t be the least bit surprised to find that I’m missing some flags in the compile or link stages (or even misunderstanding how dll’s work).

A Few Extra Notes

Running

dumpbin /exports core.lib

shows that all of the functions mentioned by the error messages are in fact exported by the core shared library.

Edit

At Pavel’s suggestion I wrote a simple C program to see if it would link. I used the same compile and link commands as above, and I ran into the same error.

The C program test.c:

#include "application.h"

int main() {
  function_in_application();
}

The error:

test.obj : error LNK2019: unresolved external symbol __imp__function_in_application referenced in function _main
  • 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-17T08:09:22+00:00Added an answer on June 17, 2026 at 8:09 am

    The libraries failed to link because core.dll and application.dll were compiled for 64 bit, and the default target for cl.exe is 32 bit. The linker failed because i was trying to link a 32 bit obj file to two 64 bit dll's. Compiling everything for 64 bit solved the problem.

    A Few Things To Be Aware Of

    • If you have the 64 bit compilers installed, you make cl.exe target 64 bit by running the the vcvarsall.bat script with an argument corresponding to your target platform (e.g. “amd64”). More in depth instructions can be found here.
    • The default version of Visual Studio Express 2010 does not install the 64 bit compilers by default. You may need to run setup.exe again and check the appropriate custom install options to install them.
    • The default version of Visual Studio Express 2012 does come with 64 bit compilers. I uninstalled the 2010 version, installed 2012, and had no problems after that.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to build an application that is launched has a transparent background, in
Background Information I'm trying to build the GAUL library according to this Instructions .
Background I have a personal project that I've been trying to build for around
I trying to build a winRT metro application that use a GridView. I get
I am trying to build a website with a background image that I want
background: trying to use the twitter gem for ruby-on-rails. in routes: map.resources :twitter_sessions map.finalize_twitter_sessions
Background: I'm trying to come up with a regex for a rewrite rule that
Some background info: I'm trying to run a server program in python 2.5.1 (the
Im trying to use a background image in a trigger.io ios mobile app but
Background: I'm trying to build a web app (as a personal project using modern

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.