for help:how to call a windows dll in linux by java program!

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
waterson79
Newbie
Newbie
Posts: 2
Joined: Wed Feb 24, 2010 9:20 pm

for help:how to call a windows dll in linux by java program!

Post by waterson79 »

hello,everyone!
I have encountered a problem when i want to call a windows dll in linux by java program, pls help me !
For the absence of the C source code, i want to migrate the windows dll to the linux ,which is called by a java program, named getDecode.dll.
The following is my steps:

[root@CGSL-N31 wine]# winedump spec -I. getDecode.dll
Contents of getDecode.dll: 360530 bytes

1 named symbols in DLL, 1 total, 1 unique (ordinal base = 1)
Done dumping getDecode.dll
Export 1 - '_Java_com_zte_ums_zxnm01_zxss_toolkit_trace_common_getDecode_getH248BinDecode@28' ... [Not Found]

[root@CGSL-N31 wine]# winebuild --def -E getDecode.spec -o getDecode.def

[root@CGSL-N31 wine]# winegcc -I/home/wine/wine-1.1.32/include -I. -lgetDecode getDecode_main.c -o getDecode_main.so -D__WINESRC__ -L. -L/usr/local/lib -lwine -lwinecrt0 -shared -specs=./getDecode.spec
gcc: specs file malformed after 139 characters
winegcc: gcc failed

The following is the content of getDecode.spec file:
# Generated from getDecode.dll by winedump

1 stub _Java_com_zte_ums_zxnm01_zxss_toolkit_trace_common_getH248Decode_getH248BinDecode

The following is the content of getDecode_main.c file:
/*
* getDecode.dll
*
* Generated from getDecode.dll by winedump.
*
* DO NOT SUBMIT GENERATED DLLS FOR INCLUSION INTO WINE!
*
*/

#include "config.h"

#include <stdarg.h>

#include "windef.h"
#include "winbase.h"
#include "getDecode_dll.h"
#include "wine/debug.h"

WINE_DEFAULT_DEBUG_CHANNEL(getH248Decode);

BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved);

switch (fdwReason)
{
case DLL_WINE_PREATTACH:
return FALSE; /* prefer native version */
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hinstDLL);
break;
case DLL_PROCESS_DETACH:
break;
}

return TRUE;
}
/******************************************************************
* _Java_com_zte_ums_zxnm01_zxss_toolkit_trace_common_getH248Decode_getH248BinDecode@28 (GETH248DECODE.1)
*
*
*/
#if 0
__stdcall GETH248DECODE__Java_com_zte_ums_zxnm01_zxss_toolkit_trace_common_getH248Decode_getH248BinDecode()
{
/* @stub in .spec */
}
#endif

My question is :what's wrong i have made?why can't i succeed to do the winegcc?what is the proper way to get the .so file?thank you in advance,thank you!
oiaohm
Level 8
Level 8
Posts: 1020
Joined: Fri Feb 29, 2008 2:54 am

Post by oiaohm »

waterson79 its not another interface for this by any chance.

http://www.erlang.org/project/megaco/index.html

If so don't bother messing around with the windows dll just port accross to native.
waterson79
Newbie
Newbie
Posts: 2
Joined: Wed Feb 24, 2010 9:20 pm

Post by waterson79 »

oiaohm, thank you for your reply, but I do not want a new package to deal with the H248 protocol, because the data from the network devices is not the standard H248 stream which has been transformed. The dll supplied by the network devices is to deal with this transform.
Thanks!
oiaohm wrote:waterson79 its not another interface for this by any chance.

http://www.erlang.org/project/megaco/index.html

If so don't bother messing around with the windows dll just port accross to native.
vitamin
Moderator
Moderator
Posts: 6605
Joined: Sat Feb 23, 2008 2:29 pm

Re: for help:how to call a windows dll in linux by java prog

Post by vitamin »

waterson79 wrote:how to call a windows dll in linux by java program!
Simple answer: you can't.
A bit longer answer: you should never do such a stupid thing in the first place!

A long answer:
- You'll need an entire Wine to call even a single dll. Which means you'll have to run entire java under Wine.
- What an idiot uses java (a cross-platform language/environment) to call specific system libraries? Either do it the right way (with an extra class that wraps calls to a library, which in turn calls native libraries). Or throw away java and use something more appropriate like c/c++.
Locked