DLL function call

VA Smalltalk is a "100% VisualAge compatible" IDE that includes the original VisualAge technology and the popular VA Assist and WidgetKit add-ons.

Moderators: Eric Clayberg, wembley, tc, Diane Engles, solveig

DLL function call

Postby yeshli sheela » Sun Apr 13, 2008 8:36 pm

I'm trying to call a DLL function from VA Smalltalk (my first time), something like:

| dllMethod result |

dllMethod := PlatformFunction
callingConvention: 'C'
function: 'doNothing'
library: 'Only.dll'
parameterTypes: #( )
returnType: #uint32.
result := dllMethod call.
.....
^ result.

The DLL is located in the "C:\WINDOWS\system32" folder and registered.
The DLL is originally some basic Java code packaged as a bean and then as an ActiveX control (using ActiveX Bridge) - I've followed the instructions on <http://java.sun.com/j2se/1.4.2/docs/guide/beans/axbridge/developerguide/index.html>

When running the Smalltalk code I get the following: 'Primitive failed in: PlatformFunction>>#call due to OS error4'

Can anyone help me understand what I'm doing wrong or otherwise advise how to access Java code from VA Smalltalk ?
Thanks
yeshli sheela
 
Posts: 3
Joined: Sun Apr 13, 2008 7:48 pm

Re: DLL function call

Postby nmongeau » Mon Apr 14, 2008 6:04 am

are you sure the dll works, i.e. have you tried calling it from another language?

The error reports a problem with the fourth argument, so can you post the exact function definition of your dll, and how you're calling it exactly?

Normand
nmongeau
[|]
 
Posts: 29
Joined: Fri Jan 12, 2007 9:37 am

Re: DLL function call

Postby marten » Mon Apr 14, 2008 6:24 am

yeshli sheela wrote:I'm trying to call a DLL function from VA Smalltalk (my first time), something like:

| dllMethod result |

dllMethod := PlatformFunction
callingConvention: 'C'
function: 'doNothing'
library: 'Only.dll'
parameterTypes: #( )
returnType: #uint32.
result := dllMethod call.
.....
^ result.

The DLL is located in the "C:\WINDOWS\system32" folder and registered.
The DLL is originally some basic Java code packaged as a bean and then as an ActiveX control (using ActiveX Bridge) - I've followed the instructions on <http://java.sun.com/j2se/1.4.2/docs/guide/beans/axbridge/developerguide/index.html>

When running the Smalltalk code I get the following: 'Primitive failed in: PlatformFunction>>#call due to OS error4'

Can anyone help me understand what I'm doing wrong or otherwise advise how to access Java code from VA Smalltalk ?
Thanks


If I understand this correctly you want to call an ActiveX component - then I would load the feature "OLE support" to your VA system, and let the system generate the attribute, action and event methods needed to wrap the Active X component.

Marten

Marten
Marten Feldtmann, Principal Smalltalk User, Private
SkypeMe callto://marten.feldtmann
marten
[|]
 
Posts: 641
Joined: Sat Oct 14, 2006 7:10 am
Location: Hamburg - Germany

Re: DLL function call

Postby marten » Mon Apr 14, 2008 6:26 am

nmongeau wrote:are you sure the dll works, i.e. have you tried calling it from another language?

The error reports a problem with the fourth argument, so can you post the exact function definition of your dll, and how you're calling it exactly?

Normand


I thought, that the error "4" is due to an unknown function name ? (only valid for Windows platform)

Marten
Marten Feldtmann, Principal Smalltalk User, Private
SkypeMe callto://marten.feldtmann
marten
[|]
 
Posts: 641
Joined: Sat Oct 14, 2006 7:10 am
Location: Hamburg - Germany

Re: DLL function call

Postby yeshli sheela » Mon Apr 14, 2008 3:08 pm

nmongeau wrote:are you sure the dll works, i.e. have you tried calling it from another language?

The error reports a problem with the fourth argument, so can you post the exact function definition of your dll, and how you're calling it exactly?

Normand



Thank you Normand. You are right of course - the dll doesn't work. Should have checked it first. I thought it was simple enough. So back to square 0 - need to investigate the Java side first. Sorry to have bothered you all and thanks for the prompt replies.
yeshli sheela
 
Posts: 3
Joined: Sun Apr 13, 2008 7:48 pm

Re: DLL function call

Postby yeshli sheela » Mon Apr 14, 2008 8:55 pm

marten wrote:

If I understand this correctly you want to call an ActiveX component - then I would load the feature "OLE support" to your VA system, and let the system generate the attribute, action and event methods needed to wrap the Active X component.

Marten

Marten


I think I got it right this time. I have fixed the dll and changed direction to OLE/ActiveX Control (trying to invoke a DLL method directly was totally irrelevant :oops: ). I used WindowBuilder to add this ActiveX and now I can set/get the properties of the ActiveX (written in Java) and invoke its methods from Smalltalk. Thank you for pointing me in the right direction.
I guess VA Smalltalkers are (unlike me) so smart that they don't need too much help.
Still I am happy to share what I've learnt the hard way (to save some time to someone out there) if you could let me know where to put this piece of info.
Thank you
Yeshli Sheela
yeshli sheela
 
Posts: 3
Joined: Sun Apr 13, 2008 7:48 pm


Return to VA Smalltalk 7.0, 7.5 & 8.0

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest