tags:

views:

77

answers:

2

I have been given the task to upgrade an existing 16 Bit Desktop application originally written in GFA Basic. I want to know if there is a possibility to access the functions inside these 16 Bit Dlls via C/JNI (or any other programming language). I guess, I have to write some sort of an intermediate DLL to access the functionalities from a Java class (or any other language).

For example DLLTEST has the implementation of the functions

$Library 'LNK Exe d:\DLLtest.dll

Procedure LIBMAIN(hInst&, DSeg&, HpSz&, lpCmd%)

q_dllname$ = "DLLtext.dll" RETVAL 1 ' If LIBMAIN is used, then RETVAL must be TRUE

Return

Procedure WEP(SysExit&) ' ##############################################

// SysExit = 1 - ExitWindows

// SysExit = 0 - DLL vrijgegeven

RETVAL 0 ' ???????????

Return

Procedure TextTest(dc&)

$EXPORT TextTest

SETDC dc&

RGBColor 0

Local t$ = "Hello world" + Chr$(0)

Text 10, 10, t$ Beep

~TextOut(dc&, 10, 50, V:t$, Len(t$))

Beep

Return

The above dll file is in turn used by TESTTEXT.exe

// destination exe file

'LNK Exe d:\testtext.exe

DLL #7, "dlltest.dll"

DECL LONG TextTest(W)

ENDDLL

OpenW # 1

h& = Win(1)

SETDC GetDC(h&)

' RGBCOLOR 0

' GRAPHMODE R2_COPYPEN

~@@TextTest(_DC())

KeyGet k%

CloseW # 1

FreeDll 7

End

I want to rewrite this TESTTEXT.exe using Java/C (or any other moder programming language). I guess, I need to build a bridge between this dll and the new exe by building another dll. I was hoping to get some help about writing this intermediate dll.

Also, let me know if this kind of solution makes sense!

Your help would be highly appreciated. Thanks you for your time.

+2  A: 

Using a 16-bit DLL from a 32-bit application involves what Microsoft calls (called) "flat thunking". Flat Thunking is available only in the 16/32-bit hybrid versions of Windows (Windows 95, 98, 98SE, Me).

What you want is not supported on any reasonably current version of Windows.

Jerry Coffin
Jerry's right. The only way that you could even think about doing this in any current Windows is to write a 16-bit program which loads the 16-bit DLL in the 16-bit virtual machine and then some provide some infrastructure to essentially RPC over to that 16-bit process... obviously this is pretty much untenable.
codekaizen
A: 

I agree with Jerry. In the meantime you might start looking at this post: http://www.atari-forum.com/viewtopic.php?f=69&t=4826&start=20

Chris Lively