Problem with DLL in VASmalltalk 8.0.1

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

Problem with DLL in VASmalltalk 8.0.1

Postby hart404 » Wed May 05, 2010 7:59 am

We are having a problem using a DLL that provides linkage with Lotus Notes. It's been working for years. But now when we migrate from 7.5.2 to 8.0.1 we get an error "Primitive failed due to unknown API type". We've done all the obvious things like checking to make sure the DLL is in the right location. Can anyone give us a clue about what might be going on here, please? Full stack trace follows.

Phil

Debugger Stack Trace Report:
Error String: 'Primitive failed in: PlatformFunction>>#callWith:with: due to Unknown API type'
Resumable: false

UIProcess
Name: (5/3/2010 4:41:34 PM)
Process State: suspended
Priority: 3

Executing in: [] in <optimized block>(ExceptionalEvent class)>>#initializeSystemExceptions

System Configuration Dump


Copyright:

VA Smalltalk V8.0.1 ; Image: 8.0.1
VM Timestamp: 4.0,(NC) 11/2/2009 (79)
(C) Copyright Instantiations 1994, 2009. All rights reserved.
(C) Copyright International Business Machines Corp. 1994, 2006. All rights reserved.

Time: 4:48:38 PM
Date: 5/3/2010

Platform:

Virtual machine: ES
Bytecode version: 4.0
Manager version: 4.00
'OS' subsystem: 'WIN32s'
'CLIM' subsystem: 'ES'
'CP' subsystem: 'WIN32s'
'CLDT' subsystem: 'ES'
'CFS' subsystem: 'WIN32s'
'SCI' subsystem: 'WIN'
'CW' subsystem: 'WIN32s'
'CPM' subsystem: 'ES'
'CG' subsystem: 'WIN32s'
'CPIC' subsystem: 'WIN32s'

Current user:

Connected Library:

Pathname: C:\Program Files\vast801\manager\manager\nwamgr80.dat

INFO: Trapped error dumping system configuration.
=============<STACK TRACE BEGINS>============
[] in <optimized block>(ExceptionalEvent class)>>#initializeSystemExceptions
signal=Signal on Exception: (ExError) An error has occurred.
Signal>>#evaluate:
self=Signal on Exception: (ExError) An error has occurred.
aBlock=[] in ExceptionalEvent class>>#initializeSystemExceptions
Signal>>#evaluateDefaultHandler:
self=Signal on Exception: (ExError) An error has occurred.
aBlock=[] in ExceptionalEvent class>>#initializeSystemExceptions
ExceptionalEvent>>#applyDefaultHandler:
self=Exception: (ExError) An error has occurred.
aSignal=Signal on Exception: (ExError) An error has occurred.
exception=Exception: (ExError) An error has occurred.
ExceptionalEvent>>#signalFor:
self=Exception: (ExError) An error has occurred.
aSignalOrExceptionSelector=Signal on Exception: (ExError) An error has occurred.
handler=nil
ExceptionalEvent>>#signalWithArguments:
self=Exception: (ExError) An error has occurred.
arguments=('Primitive failed in: PlatformFunction>>#callWith:with: due to Unknown API type')
ExceptionalEvent>>#signalWith:
self=Exception: (ExError) An error has occurred.
arg1='Primitive failed in: PlatformFunction>>#callWith:with: due to Unknown API type'
PlatformFunction(Object)>>#error:
self=<pascal: uint16 'NOTES.DLL':NotesInitExtended uint32 pointer>
aString='Primitive failed in: PlatformFunction>>#callWith:with: due to Unknown API type'
PlatformFunction(Object)>>#primitiveFailed:withArgument:backUp:
self=<pascal: uint16 'NOTES.DLL':NotesInitExtended uint32 pointer>
errorCode=15
argument=-1
backUp=1
PlatformFunction(Object)>>#primitiveFailed
self=<pascal: uint16 'NOTES.DLL':NotesInitExtended uint32 pointer>
PlatformFunction>>#callWith:with:
self=<pascal: uint16 'NOTES.DLL':NotesInitExtended uint32 pointer>
arg1=1
arg2=*UtyOSPtr {16r001855E8}
[] in UtyNotesAPIApp class>>#notesInitialize
self=UtyNotesAPIApp
UtyNotesStatus class>>#evaluate:
self=UtyNotesStatus
aBlock=[] in UtyNotesAPIApp class>>#notesInitialize
UtyNotesAPIApp class>>#notesInitialize
self=UtyNotesAPIApp
ScyLnBasePersistencyApp class>>#connectToLotusNotes
self=ScyLnBasePersistencyApp
lnStoragePolicies=OrderedCollection(ScyLnTaskNumberRecordStoragePolicy ScyLnPatchStoragePolicy ScyLnCustomAttributeDefinitionManagerStoragePolicy ScyLnUserStoragePolicy ScyLnTaskStoragePolicy ScyLnFixStoragePolicy ScyLnProductStoragePolicy ScyLnTaskHistoryItemStoragePolicy ScyLnProductReleaseStoragePolicy )
errorText=nil
UndefinedObject>>#Doit
self=nil
EsCompiler class>>#evaluateForNil:additionalPoolNames:ifFail:
self=EsCompiler
sourceString='ScyLnBasePersistencyApp connectToLotusNotes'
additionalPoolNames=(#CfsConstants #CgConstants #CwConstants #CldtConstants #SystemExceptions)
exceptionHandler=[] in EtWorkspace>>#evaluateSelectionIn:ifFail:
descriptor=UndefinedObject:initialized
result=an EsCompilationResult
StsTranscript(EtWindow)>>#evaluate:for:ifFail:
self=a StsTranscript
text='ScyLnBasePersistencyApp connectToLotusNotes'
doitReceiver=nil
exceptionHandler=[] in EtWorkspace>>#evaluateSelectionIn:ifFail:
[] in StsTranscript(EtWorkspace)>>#evaluateSelectionIn:ifFail:
self=a StsTranscript
aWidget=CwText(text)
failBlock=[]
text='ScyLnBasePersistencyApp connectToLotusNotes'
result=nil
failed=false
EmSystemConfiguration>>#showBusyCursorWhile:
self=an EmSystemConfiguration
aBlock=[] in EtWorkspace>>#evaluateSelectionIn:ifFail:
shell=CwTopLevelShell(Transcript)
window=nil
StsTranscript(EtWindow)>>#execShortOperation:
self=a StsTranscript
aBlock=[] in EtWorkspace>>#evaluateSelectionIn:ifFail:
StsTranscript(EtWorkspace)>>#evaluateSelectionIn:ifFail:
self=a StsTranscript
aWidget=CwText(text)
failBlock=[]
text='ScyLnBasePersistencyApp connectToLotusNotes'
result=nil
failed=false
[] in StsTranscript(EtWindow)>>#menuEditExecute
self=a StsTranscript
widget=CwText(text)
EmSystemConfiguration>>#showBusyCursorWhile:
self=an EmSystemConfiguration
aBlock=[] in EtWindow>>#menuEditExecute
shell=CwTopLevelShell(Transcript)
window=a CgWindow
StsTranscript(EtWindow)>>#execShortOperation:
self=a StsTranscript
aBlock=[] in EtWindow>>#menuEditExecute
StsTranscript(EtWindow)>>#menuEditExecute
self=a StsTranscript
widget=CwText(text)
CwMenuPushButton>>#dispatchTo:
self=a CwMenuPushButton
receiver=a StsTranscript
selectorOrDirectedMessage=#menuEditExecute
CwMenu>>#simpleCallback:clientData:callData:
self=a CwMenu
w=CwPushButton(button_5)
index=5
callData=CwAnyCallbackData(
reason -> 10
)
CwCallbackRec>>#callWith:callData:
self=a CwCallbackRec
aWidget=CwPushButton(button_5)
callData=CwAnyCallbackData(
reason -> 10
)
CwPushButton(CwBasicWidget)>>#callCallbackList:callData:
self=CwPushButton(button_5)
aCallbackList=OrderedCollection(a CwCallbackRec )
callData=CwAnyCallbackData(
reason -> 10
)
callbacks=nil
size=1
rec1=nil
rec2=nil
rec3=nil
[] in CwRowColumn>>#simple:clientData:callData:
self=CwRowColumn(~Edit)
aRowColumn=CwRowColumn(~Edit)
clientData=nil
callData=CwRowColumnCallbackData(
reason -> 10
widget -> CwPushButton(button_5)
data -> nil
callbackData -> CwAnyCallbackData(
reason -> 10
)
)
data=CwAnyCallbackData(
reason -> 10
)
index=5
list=OrderedCollection(a CwCallbackRec )
child=CwPushButton(button_5)
OrderedCollection>>#do:
self=OrderedCollection(CwPushButton(button_0) CwPushButton(button_1) CwSeparator(button_2) CwPushButton(button_2) CwPushButton(button_3) CwPushButton(button_4) CwSeparator(button_5) CwPushButton(button_5) CwPushButton(button_6) CwPushButton(button_7) CwPushButton(button_8) CwPushButton(button_9) CwSeparator(button_10) CwPushButton(button_10) CwPushButton(button_11) CwSeparator(button_12) CwCascadeButton(button_12) )
aBlock=[] in CwRowColumn>>#simple:clientData:callData:
CwRowColumn>>#simple:clientData:callData:
self=CwRowColumn(~Edit)
aRowColumn=CwRowColumn(~Edit)
clientData=nil
callData=CwRowColumnCallbackData(
reason -> 10
widget -> CwPushButton(button_5)
data -> nil
callbackData -> CwAnyCallbackData(
reason -> 10
)
)
data=CwAnyCallbackData(
reason -> 10
)
index=5
list=OrderedCollection(a CwCallbackRec )
CwCallbackRec>>#callWith:callData:
self=a CwCallbackRec
aWidget=CwRowColumn(~Edit)
callData=CwRowColumnCallbackData(
reason -> 10
widget -> CwPushButton(button_5)
data -> nil
callbackData -> CwAnyCallbackData(
reason -> 10
)
)
CwRowColumn(CwBasicWidget)>>#callCallbackList:callData:
self=CwRowColumn(~Edit)
aCallbackList=OrderedCollection(a CwCallbackRec )
callData=CwRowColumnCallbackData(
reason -> 10
widget -> CwPushButton(button_5)
data -> nil
callbackData -> CwAnyCallbackData(
reason -> 10
)
)
callbacks=nil
size=1
rec1=nil
rec2=nil
rec3=nil
CwRowColumn>>#entry:clientData:callData:
self=CwRowColumn(~Edit)
aWidget=CwPushButton(button_5)
callbackList=nil
callData=CwAnyCallbackData(
reason -> 10
)
entryCallData=CwRowColumnCallbackData(
reason -> 10
widget -> CwPushButton(button_5)
data -> nil
callbackData -> CwAnyCallbackData(
reason -> 10
)
)
CwPushButton>>#callActivateCallback:
self=CwPushButton(button_5)
anEvent=an OSEvent
OSMenuItem(OSWidget)>>#callHandlers:with:
self=OSMenuItem()
handlers=#callActivateCallback:
data=an OSEvent
DirectedMessage>>#send
self=DirectedMessage (OSMenuItem(), #callHandlers:with:, (#callActivateCallback: an OSEvent))
OSEventManager class>>#runDeferredMessages
self=OSEventManager
messageAvailable=true
message=DirectedMessage (OSMenuItem(), #callHandlers:with:, (#callActivateCallback: an OSEvent))
state=true
OSWidget class>>#readAndDispatch
self=OSWidget
state=true
gotEvent=true
CwAppContext>>#readAndDispatch
self=a CwAppContext
AbtWindowSystemStartUp class(EsWindowSystemStartUp class)>>#messageLoop
self=AbtWindowSystemStartUp
lastEventTime=26401156
appContext=a CwAppContext
[] in <optimized block>(UIProcess class)>>#forkUserInterface
[] in UIProcess(Process)>>#executeBlock:withArguments:
self=UIProcess:(5/3/2010 4:41:34 PM){suspended,3}
aBlock=[] in UIProcess class>>#forkUserInterface
args=()
UIProcess(Process)>>#executeBlock:withArguments:
self=UIProcess:(5/3/2010 4:41:34 PM){suspended,3}
aBlock=[] in UIProcess class>>#forkUserInterface
args=()
UIProcess(Process)>>#newProcessOn:stackSize:withArguments:named:
self=UIProcess:(5/3/2010 4:41:34 PM){suspended,3}
aBlock=[] in UIProcess class>>#forkUserInterface
stackSize=1024
args=()
procName='(5/3/2010 4:41:34 PM)'
==============<STACK TRACE ENDS>=============
hart404
 
Posts: 9
Joined: Wed May 05, 2010 7:22 am

Re: Problem with DLL in VASmalltalk 8.0.1

Postby wembley » Wed May 05, 2010 9:49 am

Phil -

I've looked at VM code as far back as 6.0 and I don't see any support for the Pascal calling convention on Windows, only on OS/2.

Is it possible that you were running with a modified/extended version of the PlatformFunction class that aliased Pascal to something else?
John O'Keefe [|], Principal Smalltalk Architect, Instantiations Inc.
wembley
Moderator
 
Posts: 405
Joined: Mon Oct 16, 2006 3:01 am
Location: Durham, NC

Re: Problem with DLL in VASmalltalk 8.0.1

Postby hart404 » Thu May 06, 2010 8:45 am

John

Good talking to you again! Hope everything is going well for you. Just ordered a couple of "Old dude who knows Smalltalk" shirts. Hilarious!

Anyway, it's been a long time since I looked at this code. Can you give me some high level guidance as to how we might have modified/extended the VM, please?

Phil
hart404
 
Posts: 9
Joined: Wed May 05, 2010 7:22 am

Re: Problem with DLL in VASmalltalk 8.0.1

Postby wembley » Thu May 06, 2010 9:20 am

Phil -

Sorry, I guess I wasn't clear. It isn't the VM that you might have modified, it is the PlatformFunction class in Smalltalk. So, on your old system, inspect the CallingConventions class variable in PlatformFunction. It should contain an array that looks like this:
Code: Select all
(('c' 'abtsystem' 'abtc32') ('userprim') ('pascal16' 'c16' 'abtsystem16' 'abtpascal16') ('pascal' 'abtpascal32') ('mvs') ('cdecl16' 'abtc16') ('thiscall') ('ile'))
. If it doesn't, please post what it does look like.
John O'Keefe [|], Principal Smalltalk Architect, Instantiations Inc.
wembley
Moderator
 
Posts: 405
Joined: Mon Oct 16, 2006 3:01 am
Location: Durham, NC

Re: Problem with DLL in VASmalltalk 8.0.1

Postby wembley » Sat May 08, 2010 2:06 am

Phil -

Another thing to try is you old (working) image running on the V8.0.1 VM.
John O'Keefe [|], Principal Smalltalk Architect, Instantiations Inc.
wembley
Moderator
 
Posts: 405
Joined: Mon Oct 16, 2006 3:01 am
Location: Durham, NC

Re: Problem with DLL in VASmalltalk 8.0.1

Postby hart404 » Mon May 10, 2010 12:18 pm

John

Here is the CallingConventions class var contents in 7.5.2:
(('c' 'abtsystem' 'abtc32') ('userprim') ('pascal16' 'c16' 'abtsystem16' 'abtpascal16') ('pascal' 'abtpascal32') ('mvs') ('cdecl16' 'abtc16') ('thiscall') ('ile'))

In 8.0.1 it looks like:
(('c' 'abtsystem' 'abtc32') ('userprim') ('pascal16' 'c16' 'abtsystem16' 'abtpascal16') ('pascal' 'abtpascal32') ('mvs') ('cdecl16' 'abtc16') ('thiscall') ('ile') ('cdecl'))

Out platform function call definition looks like:

<pascal: uint16 'NOTES.DLL':NotesInitExtended uint32 pointer>

Does this shed any light on the problem? I've asked the developer to try running the old 7.5.2 image directly under 8.0.1.

Phil
hart404
 
Posts: 9
Joined: Wed May 05, 2010 7:22 am

Re: Problem with DLL in VASmalltalk 8.0.1

Postby hart404 » Mon May 10, 2010 1:00 pm

John

The developer tried the 7.5.2 image against the 8.0.1 VM and it will connect to Notes correctly. She can continue with this image, I presume, but I'd still like to track down this problem. Any other ideas, please?

Phil
hart404
 
Posts: 9
Joined: Wed May 05, 2010 7:22 am

Re: Problem with DLL in VASmalltalk 8.0.1

Postby wembley » Mon May 10, 2010 7:43 pm

Phil -

The CallingConvention class var in 7.5.2 and 8.0.1 look exactly as I would expect them to. So something has changed in the VM that isn't obvious since, as I mentioned previously, the only reference to PASCAL as a calling convention that I see in a 7.5.2 VM is for OS/2. I've opened case 46415 on your behalf and will let you know what I find.
John O'Keefe [|], Principal Smalltalk Architect, Instantiations Inc.
wembley
Moderator
 
Posts: 405
Joined: Mon Oct 16, 2006 3:01 am
Location: Durham, NC

Re: Problem with DLL in VASmalltalk 8.0.1

Postby hart404 » Tue May 11, 2010 9:43 am

John

Our developer is successfully using the 7.4.2 image against the 8.0.1 VM. Therefore I can't really see the VM being a problem.

Phil
hart404
 
Posts: 9
Joined: Wed May 05, 2010 7:22 am

Re: Problem with DLL in VASmalltalk 8.0.1

Postby marten » Tue May 11, 2010 10:10 pm

hart404 wrote:We are having a problem using a DLL that provides linkage with Lotus Notes. It's been working for years. But now when we migrate from 7.5.2 to 8.0.1 we get an error "Primitive failed due to unknown API type".


After reading this I created a pascal based dll (using pascal calling convention) and tried to call that external function call by using <pascal: ....> but got also that error. I did not post this because then I read a posting from John, that pascal calling convention is not supported at all. Therefore I would assume - as John said - that the image is doing some interesting stuff with the calling conventions .... the vm itself is not able to do pascal calling.
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: Problem with DLL in VASmalltalk 8.0.1

Postby hart404 » Thu May 13, 2010 11:25 am

Marten

As I said before, it's been a long time since I delved into this area. Could you give me any clue as to what we might have changed to see this behavior?

Phil
hart404
 
Posts: 9
Joined: Wed May 05, 2010 7:22 am

Re: Problem with DLL in VASmalltalk 8.0.1

Postby marten » Thu May 13, 2010 1:56 pm

hart404 wrote:Marten

As I said before, it's been a long time since I delved into this area. Could you give me any clue as to what we might have changed to see this behavior?

Phil


Hmmm, try to inspect (within the 7.5.2 image) the following expression:

Code: Select all
PlatformFunction
  callingConvention: 'pascal'
  function: 'BaseCall'
  library: 'E:\dev\freePascal-dll\VAExternalCallTest.dll'
  parameterTypes: #(#single #double)
  returnType: #double.


and look at the 10th byte of that ByteArray - the value should be "3".
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: Problem with DLL in VASmalltalk 8.0.1

Postby hart404 » Fri May 14, 2010 1:58 pm

Marten

The value is 3 in both images and VMs. Any other ideas?

Also, I talked with the developer today and she had NOT run the 8.0.1 VM with the 7.5.2 image. She tried that today and it gave the same error. So clearly something has changed in the VM. John, any comments?

Phil
hart404
 
Posts: 9
Joined: Wed May 05, 2010 7:22 am

Re: Problem with DLL in VASmalltalk 8.0.1

Postby marten » Fri May 14, 2010 2:28 pm

hart404 wrote:Marten

The value is 3 in both images and VMs. Any other ideas?

Also, I talked with the developer today and she had NOT run the 8.0.1 VM with the 7.5.2 image. She tried that today and it gave the same error. So clearly something has changed in the VM. John, any comments?

Phil


Ok, I can confirm this. Code like this

Code: Select all
startPascalExternalCall
   "MSKCallbackTest new   startPascalExternalCall"
   | platformFunction result |
      
   platformFunction := PlatformFunction
                                        callingConvention: 'pascal'
                                        function: 'PascalCalling'
                                        library: 'E:\dev\freePascal-dll\VAExternalCallTest.dll'
                                        parameterTypes: #(#double #double)
                                        returnType: #double.   
   result := platformFunction callWith: 1.0 with: 3.0.   
   platformFunction library close.   
   Transcript cr ; show: 'Base Call at <',Time now printString,'> with value: ', result asString.


is working here with a 8.01 image using a 7.5.2 VM ( '4.0,(NC) 6/12/2007 (74)').
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: Problem with DLL in VASmalltalk 8.0.1

Postby hart404 » Sun May 16, 2010 12:30 pm

Marten, John

What's the next step on this issue, please?

Phil
hart404
 
Posts: 9
Joined: Wed May 05, 2010 7:22 am

Next

Return to VA Smalltalk 7.0, 7.5 & 8.0

Who is online

Users browsing this forum: No registered users and 1 guest