Load win32 dll from Android

Put problems with the Android NDK in this forum.

Load win32 dll from Android

Postby Ramana » Fri Jul 02, 2010 10:04 am

I have a native win32 dll which exports some ' native c 'functions.I want to Load this dll and access the exported methods of dll.I have created a JNI wrapper class.After creating the dll i have copied the dll to the libs folder of my android project.Now when i do the loadlibrary it throws Unsatisfied Link error.If i do the same with .so file genetared from NDK it works fine.How do i load the win32 dll?

Regards,
RAmana.
Ramana
Junior Developer
Junior Developer
 
Posts: 17
Joined: Wed May 19, 2010 6:57 am

Top

Re: Load win32 dll from Android

Postby mackyman » Sat Jul 03, 2010 6:16 am

You can't use dll's on any other platform than Windows. So you should use .so-files if you want to share code between projects. And (correct me if I'm wrong), you have to compile the .so-files with the NDK, as they output ARM assembler instead of x86/x64 assembler that is produces by default in Visual Studio (I assume that you used MSVS for constructing the dll).
mackyman
Once Poster
Once Poster
 
Posts: 1
Joined: Sat Jul 03, 2010 6:06 am

Re: Load win32 dll from Android

Postby Ramana » Tue Jul 06, 2010 10:09 am

Hi mackyman,
Thanks for the reply.As Android is Linux based platform you mean to say that we cannot load dll's and only .so files can be loaded?Ok now i have a scenario where i want to use MessageBOx function of Win32 in Android.I wrote a small sample library(Win32 dll using VS2005) which exports a function ShowMessage() which contains the actual call to win32.So how do i build this so that i can use it in Android.Should i use ndk but how do i include the path to different header files and so.So basically what is the command to compile the vS project so that it can be used in Android.?

Warm Regards,
ramana.
Ramana
Junior Developer
Junior Developer
 
Posts: 17
Joined: Wed May 19, 2010 6:57 am

Re: Load win32 dll from Android

Postby anarche » Tue Jul 06, 2010 11:13 am

AFAIK you can't. Read the previous post. This is a linux system, not windows.

Although check out the awesome work of this dude

EDIT: Windows-C and POSIX-C are different flavours of C and are not fully compatible. The binary that they compile to are completely different, since one is linux assembler and one Windows assembler.

Any and all please correct me if I'm wrong on this.
anarche
Master Developer
Master Developer
 
Posts: 369
Joined: Sun Apr 11, 2010 5:21 am

Re: Load win32 dll from Android

Postby Ramana » Wed Jul 07, 2010 5:56 am

Hi,
So instead of creating a Win32 dll from visual studio i have to create a .so using ndk with my .c/.cpp/.h files and then use it in my Android app?What is the command to reference all windows headers,libs,includes to create a .so file?
Can some body give me a small sample which actually to use a MessageBox method of win32 API in Android.

Is it really possible to call a win32 method in Android?If not any other alternatives.

Warm Regards,
ramana.
Ramana
Junior Developer
Junior Developer
 
Posts: 17
Joined: Wed May 19, 2010 6:57 am

Re: Load win32 dll from Android

Postby Ramana » Wed Jul 14, 2010 10:50 am

So finally we cant load any windows dlls in Android.In case if u are using any you have to rewrite the functionality in c/c++ without using windows headers or equivalent java code and then proceed.
Ramana
Junior Developer
Junior Developer
 
Posts: 17
Joined: Wed May 19, 2010 6:57 am

Top

Re: Load win32 dll from Android

Postby lord_ure » Thu Jul 15, 2010 8:02 am

I have already worked on this problem and you have to rewrite the windows code and remove the header. I think the best solution is to use some #define, thus your code still work on windows but you can compile it on UNIX platform.

Just define a unix variable while creating your .so library, by adding in the Android.mk file :
LOCAL_CFLAGS := -D __CYGWIN__ #Where __CYGWIN__ is my define


And in your C code :
Code: Select all
#ifdef __CYGWIN__
...
#else
#include <windows.h>
#endif
Sorry for my english, I'm french ........ :(
lord_ure
Developer
Developer
 
Posts: 46
Joined: Fri Apr 16, 2010 4:29 pm
Location: Nancy, FRANCE

Re: Load win32 dll from Android

Postby Ramana » Thu Jul 15, 2010 11:39 am

Thank u all for the inputs
Ramana
Junior Developer
Junior Developer
 
Posts: 17
Joined: Wed May 19, 2010 6:57 am

Top

Return to NDK Problems

Who is online

Users browsing this forum: Google Feedfetcher and 4 guests