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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:49:35+00:00 2026-05-27T18:49:35+00:00

I need to modify the below makefile to create a dll (SampleNew.dll) that will

  • 0

I need to modify the below makefile to create a dll (SampleNew.dll) that will run on a 32-bit windows and 64-bit Windows environment. Maybe creating two dlls (one for 64 and one for 32) is the best approach. It needs to use SampleApi.dll (in LIBS declaration below). The below doesn’t create a valid 32 bit dll for Windows. Any ideas on how to modify the below to make it work?

CMODE=

SWIG = swig
CC = $(PREFIX)gcc
LD = $(CC) 

OBJ_DIR = obj
AUTOGEN_DIR = ../src/java
PACKAGE_DIR = $(AUTOGEN_DIR)/com/test/sample

PACKAGE = com.test.sample

INCLUDES = -I$(JAVA_INCLUDE) \
           -I$(SAMPLE_DIR)/include \
           -I$(JDK_HOME)/include

LIB_INCLUDES = -L$(SAMPLE_DIR)/lib

LIBS = /lib/libssl.so.4 \
       /lib/libcrypto.so.4 \
       -lSampleApi \
       -lm

DIRS = $(PACKAGE_DIR) $(DIST_DIR) $(OBJ_DIR) $(AUTOGEN_DIR)

CFLAGS = $(CMODE) -Wall -fpic $(INCLUDES) -O0 -g3
SFLAGS = -java $(INCLUDES) -package $(PACKAGE) -outdir $(PACKAGE_DIR)
LDFLAGS = -shared $(LIB_INCLUDES) $(LIBS)

OBJECTS = $(OBJ_DIR)/test_wrap.o
TARGET = $(LIB_DIR)/SampleNew.dll

all: $(DIRS) $(TARGET)

%_wrap.c: %.i
    $(SWIG) $(SFLAGS) $< 

$(OBJ_DIR)/%.o: %.c
    $(CC) $(CFLAGS) -c $< -o $@

$(TARGET): $(OBJECTS)
    $(LD) $(OBJECTS) $(LDFLAGS) -o $@

$(DIRS):
    mkdir -p $@

clean:
    rm -rf $(TARGET) $(PACKAGE_DIR)/* $(TARGET) $(AUTOGEN_DIR) $(OBJ_DIR)

Exception:

java.lang.UnsatisfiedLinkError c:\test\myDllFile.dll: can't load this .dll (machine code=0x101) on a IA 32-bit platform

update Makefile:

CMODE=

SWIG = swig
PREFIX=/test/mingw/mingw32/bin/i386-mingw32-
CC = $(PREFIX)gcc
LD = $(CC) 

OBJ_DIR = obj
AUTOGEN_DIR = ../src/java
PACKAGE_DIR = $(AUTOGEN_DIR)/com/test/jni

PACKAGE = com.test.jni

INCLUDES = -I$(HEADER_FILES_DIR) # env var that points to a dir with all the .h files

LIB_INCLUDES = -L$(C_API_DIR)/lib # env var that points to a dir with the C libraries (dlls)

LIBS = -lMainApi \ # MainApi.dll
       -lm

DIRS = $(PACKAGE_DIR) $(DIST_DIR) $(OBJ_DIR) $(AUTOGEN_DIR) # DIST_DIR is passed in 

CFLAGS = $(CMODE) -Wall -fpic $(INCLUDES) -O0 -g3
SFLAGS = -java $(INCLUDES) -package $(PACKAGE) -outdir $(PACKAGE_DIR)
LDFLAGS = -shared $(LIB_INCLUDES) $(LIBS) -leay32 -lws2_32 -lrpcrt4

OBJECTS = $(OBJ_DIR)/test_wrap.o
TARGET = $(LIB_DIR)/SampleJni.dll

all: $(DIRS) $(TARGET)

%_wrap.c: %.i
    $(SWIG) $(SFLAGS) $< 

$(OBJ_DIR)/%.o: %.c
    $(CC) $(CFLAGS) -c $< -o $@

$(TARGET): $(OBJECTS)
    $(LD) $(OBJECTS) $(LDFLAGS) -o $@

$(DIRS):
    mkdir -p $@

clean:
    rm -rf $(TARGET) $(PACKAGE_DIR)/* $(TARGET) $(AUTOGEN_DIR) $(OBJ_DIR)
  • 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-05-27T18:49:36+00:00Added an answer on May 27, 2026 at 6:49 pm

    The simplest thing you can do is to build both separately. For example, defining:

    CFLAGS = $(CMODE) -Wall -fpic $(INCLUDES) -O0 -g3 -march=$(ARCH)
    OBJ_DIR = obj-$(ARCH)
    LIB_DIR = lib-$(ARCH)
    
    .PHONY: default
    default:
            $(MAKE) ARCH=i686 all
            $(MAKE) ARCH=x86_64 all
    

    Avoid -m32, since it generates 32bit code for x86-64, which may use instructions not available in x86.

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

Sidebar

Related Questions

I need to modify a php search script so that it can handle multiple
We have an issue where we need to modify keys for users that are
I have a row of data that I need to modify in a database,
I have some JSF code that currently works (as shown below), and I need
I have a set of 4 massive CSV files that I need to modify.
I need help with a regular expression that will find matches in the strings
I'm wondering how to modify my below code so that I may determine if
My problem is, frankly, that I'm unsure how this works. I need to modify
The statement below will load all images that do not begin with an underscore
I need to modify a (xml-)file from Apache Ant. loadfile task allows to load

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.