Tim Peterson
11/6/2005 6:00:00 PM
Followup - Reponse received in Yahoo Forum
Hi,
Interresting topic, a couple of years ago I tried the same thing:
accessing an array from a dll within Axapta. The result was that I got
the same behaviour as you describe - a hidden feature to close Axapta
even faster than my eyes can see ;-)
Alternative:
After some research I descovered that there is some kind of standard to
cope with these things. But it is only aplicable to com interfaces.
Google for ¨create COM next value methods".
In pseudo code it goes like this:
while (i get a next value from thirdpartydllmethod) { do something with
it }. Note that the method never passes an array, instead it returns the
next-value (until next value is null).
Also what I discoverd in interfacing with third party dll''s is that the
values given back in a fixed array, the offset to read the value is the
offset-count to the power of two. I don''t know if I am clear enough... I
mean you can''t just add the count of bytes to the previously read value,
to retrieve the next value. That way you would be reading something
which is not there, Axapta would go out of it''s own boundries and
windows will shut it down at ones.
Can you give some more details on the peace of software you try to
interface with? Perhaps there are better ways to this problem?
Just some thoughts,
/b
--
Can anybody shed any further light on this issue. MAYBE even one of
Microsofts technical gurus with nitty gritty details????
Would appreciate all comments and suggestions. The DLL developer is
available to modify the DLL IO as necessary
Tim Peterson
Zapta Newbie
"Tim Peterson" wrote:
> Hi All,
> I''m new to this and would appreciate any help! Micorsoft... Are You Out There?
>
> I''m writing a class wrapper to integrate a 3rd party DLL which requires
> exchanging data through many parms through pointers to binary objects. After
> all the frustration of getting the data set up correctly (remember I''m new at
> this.. jumping right into bits/bytes hurt my brain) I was riding a huge high
> and proud of myself and
> then I ran what I thought I was home free and CRASH
>
> Axapta just disappears... poof gone.. no error warnings.. no "Send
> Error to Microsoft... no nothin!!
>
> I suspect this is occurring at the point in the DLL logic where it
> attempts to write the solution to the binary space passed to it.
> Anybody have any experience with this?
>
> --
> Tim Peterson
> Zapta Newbie
>
> CODE IS AS FOLLOWS:
>
> client static int runDLL()
> {
> Dll ringoDLL;
> DllFunction LSsolveRingo2;
>
> int iRingoReturn;
> int nIntParams,nDblParams;
>
> Binary dParams,nParams,RMLength,RMCostCwt,RMAvail,FGCredit,Diam;
> Binary
> EndDrop,Bundle,FGNeeded,FGMax,Iyldpt,Iyield,Indxrm,NumCopies;
> Binary Infgup,Ifg,Ifup;
> Binary Objval,Objbnd,numpats;
>
>
> // Declare Vars used to query output
> real oObjVal,oObjbnd;
> int oNumPats;
>
> ;
> // Binary array equivalents CALC BASED ON TEST DAT
> nParams = new Binary(20); // 5 ints * 4 bytes = 20
> dParams = new Binary(32); // 4 dbl * 8 bytes = 32
> RMLength = new Binary(16); // 2 dbl * 8 bytes = 16
> RMCostCwt = new Binary(16); // 2 dbl * 8 bytes = 16
> RMAvail = new Binary(16); // 2 dbl * 8 bytes = 16
> FGCredit = new Binary(32); // 4 dbl * 8 bytes = 32
> Diam = new Binary(32); // 4 dbl * 8 bytes = 32
> EndDrop = new Binary(32); // 4 dbl * 8 bytes = 32
> Bundle = new Binary(8); // 2 ints * 4 bytes = 8
> FGNeeded = new Binary(16); // 4 ints * 4 bytes = 16
> FGMax = new Binary(16); // 4 ints * 4 bytes = 16
> Iyldpt = new Binary(16); // 4 ints * 4 bytes = 16
> Iyield = new Binary(20); // 5 ints * 4 bytes = 20
> Indxrm = new Binary(400); // 100 ints * 4 bytes = 400
> NumCopies = new Binary(400); // 100 ints * 4 bytes = 400
> Infgup = new Binary(400); // 100 ints * 4 bytes = 400
> Ifg = new Binary(400); // 100 ints * 4 bytes = 400
> Ifup = new Binary(400); // 100 ints * 4 bytes = 400
>
> // Binary objects for return solution
> Objval = new Binary(8);
> Objbnd = new Binary(8);
> numpats = new Binary(4);
>
> // Define function parameters
> ringoDLL = new DLL(''c:\\RingoDLL\\ringo3'');
> LSsolveRingo2 = new DLLFunction(ringoDLL,''LSsolveRingo2'');
>
> LSsolveRingo2.returns(ExtTypes::DWord);
> LSsolveRingo2.arg(ExtTypes::Pointer, // nParams int
> ExtTypes::DWord, // nIntParams int
> ExtTypes::Pointer, // dParams dbl
> ExtTypes::DWord, // nDblParams int
> ExtTypes::Pointer, // RMLength dbl
> ExtTypes::Pointer, // RMCostcwt dbl
> ExtTypes::Pointer, // Bundle int
> ExtTypes::Pointer, // RMAvail dbl
> ExtTypes::Pointer, // FGNeeded int
> ExtTypes::Pointer, // FGMax int
> ExtTypes::Pointer, // FGCredit dbl
> ExtTypes::Pointer, // Diam dbl
> ExtTypes::Pointer, // EndDrop dbl
> ExtTypes::Pointer, // Iyldpt int
> ExtTypes::Pointer, // Iyield int
> ExtTypes::Pointer, // Objval Ptr
> ExtTypes::Pointer, // Objbnd Ptr
> ExtTypes::Pointer, // Numpats Ptr
> ExtTypes::Pointer, // Indxrm int
> ExtTypes::Pointer, // Numcopies int
> ExtTypes::Pointer, // Infgup int
> ExtTypes::Pointer, // Ifg int
> ExtTypes::Pointer); // Ifup int
>
>
>
> // Fill test data
> // The dWord(1,2) parameters ar 1 = Start byte offset 2 = Value
> placed in byte
> nintParams = 5;
> nParams.dWord( 0, 4); // Numfps
> nParams.dWord( 4, 2); // Numrm
> nParams.dWord( 8,100); // Numpatsmx
> nParams.dWord(12,100); // Numelsmx
> nParams.dWord(16, 60); // Limsecs
>
> nDblParams = 4;
> dParams.Double( 0,0.3400); // NeutralAxis
> dParams.Double(8,3.1900); // WtPerFt
> dParams.Double(16,0.0000); // Cpcut
> dParams.Double(24,3.14159); // PI
>
> RMLength.Double( 0,20.00); // Double
> RMLength.Double( 8,40.00);
>
> RMCostcwt.Double( 0,30.43); // Double
> RMCostcwt.Double( 8,30.43);
>
> Bundle.dWord( 0,1); // Integer
> Bundle.dWord( 4,1);
>
> Rmavail.Double( 0,9999.99); // Double
> Rmavail.Double( 8,9999.99);
>
> FGNeeded.dWord( 0, 4); // Integer
> FGNeeded.dWord( 4, 2);
> FGNeeded.dWord( 8,100);
> FGNeeded.dWord(12,100);
>
> FGMax.dWord( 0, 20); // Integer
> FGMax.dWord( 4, 18);
> FGMax.dWord( 8, 6);
> FGMax.dWord(12, 3);
>
> FGCredit.Double( 0,000.00); // Double
> FGCredit.Double( 8,000.00);
> FGCredit.Double(16,000.00);
> FGCredit.Double(24,000.00);
>
> Diam.Double( 0, 12.7500); // Double
> Diam.Double( 8, 48.0000);
> Diam.Double(16, 61.0625);
> Diam.Double(24,132.0000);
>
> EndDrop.Double( 0,14.000); // Double
> EndDrop.Double( 8,16.000);
> EndDrop.Double(16,16.000);
> EndDrop.Double(24,30.000);
>
> Iyldpt.dWord( 0, 2); // Integer
> Iyldpt.dWord( 4, 3);
> Iyldpt.dWord( 8, 4);
> Iyldpt.dWord(12, 5);
>
> Iyield.dWord( 0, 2); // Integer
> Iyield.dWord( 4, 1);
> Iyield.dWord( 8, 1);
> Iyield.dWord(12, 1);
> Iyield.dWord(16, 1);
>
> // Initialize ObjVal, ObjBnd and Numpats to 0
> Objval.Double(0,0.000);
> Objval.Double(0,0.000);
> Numpats.dWord( 0, 0);
>
>
> iRingoReturn = 9999;
> iRingoReturn = LSsolveRingo2.call
> (nParams,nIntParams,dParams,nDblParams,RMLength,
>
> RMCostCwt,Bundle,RMAvail,FGNeeded,FGMax,
>
> FGCredit,Diam,EndDrop,Iyldpt,Iyield,
>
> Objval,Objbnd,numpats,Indxrm,NumCopies,Infgup,
> Ifg,Ifup);
>
> return iRingoReturn;
> }
>
>