f



mex - matlab calls fortran which calls matlab which calls fortran - is it possible?

Dear All,

I'm trying to link matlab and fortran with mex files and engine matlab, in linux OS. My general purpose is the following:

1) a matlab script A calls a mex function B based upon fortran source code

2) mex function B calls another function in matlab C within matlab engine

3) matlab routine C calls another mex file in fortran D

While i'm able to do steps 2) and 3), I can't do step 1). Before to show the code, please reply to this simple question:

Is it possible to build the overall process 1-3? 
0
catamik (10)
10/8/2009 2:37:03 PM
comp.soft-sys.matlab 211265 articles. 25 followers. lunamoonmoon (257) is leader. Post Follow

12 Replies
2273 Views

Similar Articles

[PageSpeed] 11

On 8 Okt, 16:37, "Michele Catalano" <cata...@yahoo.it> wrote:
> Dear All,
>
> I'm trying to link matlab and fortran with mex files and engine matlab, in linux OS. My general purpose is the following:
>
> 1) a matlab script A calls a mex function B based upon fortran source code
>
> 2) mex function B calls another function in matlab C within matlab engine
>
> 3) matlab routine C calls another mex file in fortran D
>
> While i'm able to do steps 2) and 3), I can't do step 1). Before to show the code, please reply to this simple question:
>
> Is it possible to build the overall process 1-3?

I don't know if it is possible to do *all* of the above,
but step 1) is trivial when the MEX function is 'simple'.
And works correctly.

To investigate what is going on, make some trivial functions
A - D above, that only print some messages to the command line,
like "Entering A - Calling B" at the entry point, and
"Returned from B - Exiting A" as the last statement before
return.

This way you isolate the linking process from any problems
caused by the business code. If you can get such a simple
example to behave as expected, then the overall idea works.

Apart from that, please post any error messages that appeared
when you tried to compile the program.

Rune
0
allnor (8509)
10/8/2009 2:47:17 PM
Rune Allnor <allnor@tele.ntnu.no> wrote in message <60ac2150-8abc-4a44-bd15-8f0b963895e2@l31g2000vbp.googlegroups.com>...
> On 8 Okt, 16:37, "Michele Catalano" <cata...@yahoo.it> wrote:
> > Dear All,
> >
> > I'm trying to link matlab and fortran with mex files and engine matlab, in linux OS. My general purpose is the following:
> >
> > 1) a matlab script A calls a mex function B based upon fortran source code
> >
> > 2) mex function B calls another function in matlab C within matlab engine
> >
> > 3) matlab routine C calls another mex file in fortran D
> >
> > While i'm able to do steps 2) and 3), I can't do step 1). Before to show the code, please reply to this simple question:
> >
> > Is it possible to build the overall process 1-3?
> 
> I don't know if it is possible to do *all* of the above,
> but step 1) is trivial when the MEX function is 'simple'.
> And works correctly.
> 
> To investigate what is going on, make some trivial functions
> A - D above, that only print some messages to the command line,
> like "Entering A - Calling B" at the entry point, and
> "Returned from B - Exiting A" as the last statement before
> return.
> 
> This way you isolate the linking process from any problems
> caused by the business code. If you can get such a simple
> example to behave as expected, then the overall idea works.
> 
> Apart from that, please post any error messages that appeared
> when you tried to compile the program.
> 
> Rune

Thanks Rune,

It follows  the command and the error:

mex '-f' /home/catalanom/Scrivania/provaF/engopts.sh FortranChiamaMatlabSubII.F90
/usr/lib/gcc/i486-linux-gnu/4.2.4/libgfortranbegin.a(fmain.o): In function `main':
(.text+0x23): undefined reference to `MAIN__'
collect2: ld returned 1 exit status

    mex: link of 'FortranChiamaMatlabSubII' failed.

??? Error using ==> mex
Unable to complete successfully

It seems it asks a main program for the function A, while I have to set it as a subroutine mexfunction()

Why i get this error?

Michele
0
catamik (10)
10/8/2009 2:57:03 PM
On 8 Okt, 16:57, "Michele Catalano" <cata...@yahoo.it> wrote:
> Rune Allnor <all...@tele.ntnu.no> wrote in message <60ac2150-8abc-4a44-bd=
15-8f0b96389...@l31g2000vbp.googlegroups.com>...
> > On 8 Okt, 16:37, "Michele Catalano" <cata...@yahoo.it> wrote:
> > > Dear All,
>
> > > I'm trying to link matlab and fortran with mex files and engine matla=
b, in linux OS. My general purpose is the following:
>
> > > 1) a matlab script A calls a mex function B based upon fortran source=
 code
>
> > > 2) mex function B calls another function in matlab C within matlab en=
gine
>
> > > 3) matlab routine C calls another mex file in fortran D
>
> > > While i'm able to do steps 2) and 3), I can't do step 1). Before to s=
how the code, please reply to this simple question:
>
> > > Is it possible to build the overall process 1-3?
>
> > I don't know if it is possible to do *all* of the above,
> > but step 1) is trivial when the MEX function is 'simple'.
> > And works correctly.
>
> > To investigate what is going on, make some trivial functions
> > A - D above, that only print some messages to the command line,
> > like "Entering A - Calling B" at the entry point, and
> > "Returned from B - Exiting A" as the last statement before
> > return.
>
> > This way you isolate the linking process from any problems
> > caused by the business code. If you can get such a simple
> > example to behave as expected, then the overall idea works.
>
> > Apart from that, please post any error messages that appeared
> > when you tried to compile the program.
>
> > Rune
>
> Thanks Rune,
>
> It follows =A0the command and the error:
>
> mex '-f' /home/catalanom/Scrivania/provaF/engopts.sh FortranChiamaMatlabS=
ubII.F90
> /usr/lib/gcc/i486-linux-gnu/4.2.4/libgfortranbegin.a(fmain.o): In functio=
n `main':
> (.text+0x23): undefined reference to `MAIN__'
> collect2: ld returned 1 exit status
>
> =A0 =A0 mex: link of 'FortranChiamaMatlabSubII' failed.
>
> ??? Error using =3D=3D> mex
> Unable to complete successfully
>
> It seems it asks a main program for the function A, while I have to set i=
t as a subroutine mexfunction()
>
> Why i get this error?

I have no idea, which is why I suggested to use a simpler
example.

One possible reason is that the two mex functions, B and D,
both are called from the matlab side of things, and therefore
both contain some reference to a maun function. If this is
the case, the linker sees two different calls to main, which
is something that is not supposed to happen.

Again, try and make an as simple example as possible, to see
if the linker can handle this situation at all.

Rune
0
allnor (8509)
10/8/2009 3:19:38 PM
"Michele Catalano" <catamik@yahoo.it> wrote in message <haktee$5u3$1@fred.mathworks.com>...
> Dear All,
> 
> I'm trying to link matlab and fortran with mex files and engine matlab, in linux OS. My general purpose is the following:
> 
> 1) a matlab script A calls a mex function B based upon fortran source code
> 
> 2) mex function B calls another function in matlab C within matlab engine
> 
> 3) matlab routine C calls another mex file in fortran D
> 
> While i'm able to do steps 2) and 3), I can't do step 1). Before to show the code, please reply to this simple question:
> 
> Is it possible to build the overall process 1-3? 

Yes, you can do this, or at least something like this. But it is a bit tricky. What you can do is:

Matlab script A calls mex function B.
mex function B starts a MATLAB engine.
mex function B uses engEvalString to call function C from within the engine.
function C calls mex function D.

The tricky part is getting mex function B to compile. You will need to manually add the libeng.lib file to the mex command to make sure the mex function B has all of the engine functions. e.g.,

>> lib_eng = [matlabroot '\extern\lib\win32\microsoft\libeng.lib']
>> mex('functionB.for',lib_eng)

Then functionB will have access to the engine routines and will be able to open an engine.

Be advised, however, that the engine will open up in the default MATLAB startup directory, not the current directory. So you may need to call the engEvalString with a cd command to change to the current directory. For example, if you are in a directory that is not the default, write a file, then call functionB, which opens the engine and calls functionC, functionC will *not* be in the same directory and so it will *not* see the file you just wrote. That is why the cd will be needed in this case.

Caveat: I have done this with C, but not Fortran. I will try to cook up a Fortran example to verify that it works in Fortran also ...

James Tursa
0
10/8/2009 5:08:18 PM
"James Tursa" <aclassyguy_with_a_k_not_a_c@hotmail.com> wrote in message <hal6a2$46s$1@fred.mathworks.com>...
> 
> Caveat: I have done this with C, but not Fortran. I will try to cook up a Fortran example to verify that it works in Fortran also ...

It works in Fortran also. Here is the example I cooked up (bare bones no argument checking, and beware of typos):

File mexeng.f90:

#include "fintrf.h"
      subroutine mexFunction(nlhs, plhs, nrhs, prhs)
      implicit none
      integer*4 nlhs, nrhs
      mwPointer plhs(*), prhs(*)
!-FUN
      mwPointer engOpen
      integer*4 engPutVariable
      integer*4 engEvalString
      mwPointer engGetVariable
!-LOC
      mwPointer ep
      mwPointer mx
!-----
      ep = engOpen( "" )
      if( ep == 0 ) then
          call mexErrMsgTxt("Unable to open engine.")
      endif
      if( engPutVariable(ep, "A", prhs(1)) /= 0 ) then
          call mexErrMsgTxt("Unable to put variable into engine.")
      endif
! May need to insert cd command here so engine sees the mexsin function
      if( engEvalString(ep, "B = mexsin(A)") /= 0 ) then
          call mexErrMsgTxt("Unable to evaluate string in engine.")
      endif
      mx = engGetVariable(ep, "B")
      if( mx == 0 ) then
          call mexErrMsgTxt("Unable to get variable from engine.")
      endif
      plhs(1) = mx
      return
      end subroutine mexFunction

File mexsin.f90:

#include "fintrf.h"
      subroutine mexFunction(nlhs, plhs, nrhs, prhs)
      implicit none
      integer*4 nlhs, nrhs
      mwPointer plhs(*), prhs(*)
!-FUN
      mwPointer mxGetPr
      mwPointer mxCreateScalarDouble
      real*8 deref
!-LOC
      mwPointer dp
!-----
      dp = mxGetPr(prhs(1))
      plhs(1) = mxCreateScalarDouble(sin(deref(%val(dp))))
      end subroutine mexFunction
!-----------------------------------------------------------------
      real*8 function deref(x)
      real*8 x
      deref = x
      return
      end

To compile the mexeng.f90 file:

>> mex -setup (then select the Fortran compiler)
>> lib_eng = [matlabroot '\extern\lib\win32\microsoft\libeng.lib']
>> mex('mexeng.f90',lib_eng)

To compile the mexsin.f90 file:

>> mex mexsin.f90

mexeng opens up an engine, passes the input variable to the engine, has the engine call mexsin on that variable (which is just a Fortan sin function on a double scalar), then returns the result back up the chain. So you can compare the result with a simple sin() function call in MATLAB. I did this on a PC WinXP R2007a with Intel 9.1.  You will, of course, have to make some adjustments for your setup.

James Tursa
0
10/8/2009 5:53:02 PM
Hi James,

Unfortunately I  get errors (which I don't get with similar source codes). I compile in linux with gfortran :

>> mex '-f' /home/catalanom/.matlab/R2006a/mexopts.sh mexsin.f90

Warning: mexsin.f90:1: Illegal preprocessor directive
mexsin.f90:6.6:

      mwPointer plhs(*), prhs(*)
     1
Error: Unclassifiable statement at (1)
mexsin.f90:8.6:

.... and so on. with the same variables declaration I'm able to compile.

When fixed this i can test your setting.. At the moment I thank you for attention.

Michele
0
catamik (10)
10/9/2009 10:48:02 AM
ok , I fixed the problem, compiling in fixed format i.e. changing comments with C
and "mwPointer" to mwpointer... :(

Sorry.. Let's try to compile go on...

Michele

"Michele Catalano" <catamik@yahoo.it> wrote in message <han4d1$fb6$1@fred.mathworks.com>...
> Hi James,
> 
> Unfortunately I  get errors (which I don't get with similar source codes). I compile in linux with gfortran :
> 
> >> mex '-f' /home/catalanom/.matlab/R2006a/mexopts.sh mexsin.f90
> 
> Warning: mexsin.f90:1: Illegal preprocessor directive
> mexsin.f90:6.6:
> 
>       mwPointer plhs(*), prhs(*)
>      1
> Error: Unclassifiable statement at (1)
> mexsin.f90:8.6:
> 
> ... and so on. with the same variables declaration I'm able to compile.
> 
> When fixed this i can test your setting.. At the moment I thank you for attention.
> 
> Michele
0
catamik (10)
10/9/2009 10:58:02 AM
I compile with

mex -f /home/catalanom/.matlab/R2006a/mexopts.sh mexeng.F -L/usr/local/matlab7/usr/local/matlab7/bin/glnx86/libeng.lib

I run

y=mexeng(1)

but I get

??? Invalid MEX-file '/home/catalanom/Scrivania/provaF/mexeng.mexglx': /home/catalanom/Scrivania/provaF/mexeng.mexglx: undefined symbol: engopen_.

What could be the problem?
0
catamik (10)
10/9/2009 11:27:01 AM
Sorry just to observe that the file is not libeng.lib but libeng.so

However, I cannot run the mex file, i get always the above error
0
catamik (10)
10/9/2009 11:42:03 AM
"Michele Catalano" <catamik@yahoo.it> wrote in message <han7ia$5bs$1@fred.mathworks.com>...
> Sorry just to observe that the file is not libeng.lib but libeng.so
> 
> However, I cannot run the mex file, i get always the above error

Check your documentation for the *exact* case of the engopen etc calls. The MATLAB API for Fortran actually uses the pre-processor for these and translates them into the actual library name, but this *only* works if the case matches the pre-processor define exactly. Normally in Fortran case doesn't matter, but in this case it does. So maybe engOpen will work, or ENGOPEN, etc. Look at the exact case shown in your doc and make sure your Fortran source code uses that exact case.

James Tursa
0
10/9/2009 3:50:18 PM
Dear James, 

I checked the doc but I do not meet particular recommendation. However I try to adjust the code without any results.

Could be the underscore appended the reason? The undefined symbol is actually 
"engopen_" and not "engopen".

Finally when I compile the fengdemo.F demo file, I don't get any error. This is organized as a program main and not as mexfunction...

It seem's to me a compiler issue. Is it?



"James Tursa" <aclassyguy_with_a_k_not_a_c@hotmail.com> wrote in message <hanm3q$lds$1@fred.mathworks.com>...
> "Michele Catalano" <catamik@yahoo.it> wrote in message <han7ia$5bs$1@fred.mathworks.com>...
> > Sorry just to observe that the file is not libeng.lib but libeng.so
> > 
> > However, I cannot run the mex file, i get always the above error
> 
> Check your documentation for the *exact* case of the engopen etc calls. The MATLAB API for Fortran actually uses the pre-processor for these and translates them into the actual library name, but this *only* works if the case matches the pre-processor define exactly. Normally in Fortran case doesn't matter, but in this case it does. So maybe engOpen will work, or ENGOPEN, etc. Look at the exact case shown in your doc and make sure your Fortran source code uses that exact case.
> 
> James Tursa
0
catamik (10)
10/12/2009 9:00:22 AM
I worked using the following setting:

A) Matlab script (writes on disk the input for B) --> B)  fortran source code (as main)(reads data from disk) opens matlab engine C) --> C) launches mex file D) 

D) returns to C) --> C) collects data and send to B) --> B) close engine, qrites data to disk -- > A) reads data.

The result is a slower computation mainly due to the engine open callings.... 
0
catamik (10)
10/15/2009 1:17:04 PM
Reply:

Similar Artilces:

Call call
Hello! I have a small question concerning to the procedure call. I have the following procedure: private sub procedure_name (ByVal name1 as string) .... end sub When I call it I just write: .... procedure_name("something") ..... When I add some extra parameters into the procedure that is: private sub procedure_name (ByVal name1 as string, ByVal name2 as boolean) .... end sub then the procedure call would look like this: call procedure_name("something",True) Why???? Why there are some cases when word "call" is needed (because excluding it, it will give us an error) and why it is not needed in the other cases? When do we have to use word "call" to call procedure or function? Thank you for posts M. Why is the sky blue? I never use call. TTBOMK all procedures (subs and functions) can be executed as ProcedureName Parameter1, Parameter2, Parameter3 ... Of course, one must use FunctionName(Parameter1, Parameter2, Parameter3 ...) to get the value of a function. ...

Calling Fortran 77 from Fortran 95
When calling Fortran 77 from Fortran 95, how can I make sure the compiler will pass a contiguous array and not a dope array struct? On 2011-03-06 14:07:38 -0400, sturlamolden said: > When calling Fortran 77 from Fortran 95, how can I make sure the > compiler will pass a contiguous array and not a dope array struct? In a narrow sense your question is meaningless as F77 is a subset of F95. What you probably meant was what happens when a F95 compiler finds that it does not have an explicit interface to some procedure. That is well defined and yields what you are probably thinking of as F77 semantics. In other words, do nothing and you will get what you are probably expecting. All the nice features of F95 are associated with explicit interfaces that result from internal (i.e. contained within a larger procedure) or module prcedures. (Or you can construct an interface block if you really inisist.) In article <1d53f2c6-6d4b-4b26-b38f-796481f7c82c@j35g2000prb.googlegroups.com>, sturlamolden <sturlamolden@yahoo.no> wrote: >When calling Fortran 77 from Fortran 95, how can I make sure the >compiler will pass a contiguous array and not a dope array struct? Mark it BIND(C). In all compilers I know of, it will happen, anyway. But why do you want to? If you want to call C, you should use the C interoperability features. If not, your program can't tell. Regards, Nick Maclaren. On 6 Mar, 19:17, Gordon Sande <Gordon.Sa...@gmail.com> wrote: &...

How do I force a refresh after a header() call? How do I force a refresh after a header() call? How do I force a refresh after a header() call? How do I force a refresh after a header() call?
I've got a main loop script that calls two other scripts that do no user interaction. All they do is send a couple of mysql update statements. Then they use header() to call the main loop again. This works fine, EXCEPT the mysql statement isn't finished by the time the main loop is called. This is a problem because the main loop actually queries that same table to show the value of the rows you just changed. If I refresh the page manually, the new value is correctly displayed. I need to either be able to refresh the page upon calling it, or better yet, have a conditional statement in the subroutines that wait for the mysql statement to complete (how do you do that?). Any help is appreciated. Charles Charles Soto <charles@gtemail.net> wrote: > I've got a main loop script that calls two other scripts that do no > user interaction. All they do is send a couple of mysql update > statements. Then they use header() to call the main loop again. This > works fine, EXCEPT the mysql statement isn't finished by the time the > main loop is called. This is a problem because the main loop actually > queries that same table to show the value of the rows you just > changed. If I refresh the page manually, the new value is correctly > displayed. > > I need to either be able to refresh the page upon calling it, or > better yet, have a conditional statement in the subroutines that wait > for the mysql statement to complete...

call by need + call by reference
In EoPL the evaluator that implements call-by-need is built on the evaluator that implements call-by-reference. Is call-by-reference necessary? x is bound to a reference to a thunk and y is bound to the same reference. Why is it important for x and y to be bound to the same refererence? ((lambda(x) ((lambda (y) <expression>) x)) <expression>) Now that I've got the question out of my head and into words, I think I can see the reason - with call-by-reference the thunk is evaluated once somewhere and all procedures that have been passed the thunk will see (refer to) the expressed value. ...

Call a VI that calls a SubvI, the SubVI calls the VI --> non recursive solution
I need a example how I can call a VI a second time when i have called some SubVI's. The last SubVI can call the first SubVI or the main VI. How can I do this? My problem is that recursive solutions are not allowed in LabVIEW. &nbsp; &nbsp; _________________________________________________________________________________________ Suche ein Beispiel, wie man sinnvoll ein VI, welches mehrere SubVI aufruft, welche dann am Ende eines Dialogs s�mtliche eingegebenen Werte zusammengefasst wiederum in einem SubVI dargstellt. Falls die Eingaben widerrufen werden sollen, muss der Dialog erneut durchlaufen werden. Hierzu ben�tige ich einen L�sungsansatz, da rekursives aufrufen in LabVIEW verboten ist. K�nnte man mit globalen Variablen etwas Sinnvolles gestalten? F�r Beispiele w�re ich dankbar! ...

DLL Call inside DLL Call
Hello, &nbsp; I'm trying to make a call to a DLL that was generated with LabView, inside a DLL that itself is called&nbsp;from a LabView Application. I know it sounds deviously, to do that. But it is necessary, because we try to run a big application on a cRio platform, and get into trouble with memory resources. So we decided save resources by using a C++ DLL. Now it would be a very nice feature to use the analyse functionality from LabView inside that C++ DLL, by loading LabView VIs dynamically in form of generated DLLs. This is necessary because we need a lot of Analyse VIs, that we cannot download completely. It is no problem do run the DLLs that were generated by LabView from a console application. But when I call the same DLL inside my C++ DLL running in the LabView application it jumps to nirvana. I see the same behaviour when I try to reload the LabView Dll again in LabView. So my questions is: Does anyone know something about the mechanism, how LabView&nbsp; calls to DLLs are organized. What happens wenn I call DLLs, that were generated with LabView, that itself was Called inside a&nbsp;LabView application. In my oppinion there must be a problem with function calls to the LabView RT, from a DLL when the RT is allready startet in the same application. Does anybody has experience with such an application? &nbsp; Best regards to all Hi! &nbsp; Sorry, but i havn't experience in that kind of abstract application on RT but i've found ...

SAB2004: call for participation, call for abstracts
----- SAB2004 Call for participation, Call for Abstracts (Last-Minute-Results) ----- SAB2004, From Animals to Animats 8, The Eighth International Conference on the Simulation of Adaptive Behavior Santa Monica (Los Angeles), July 13-17 2004 http://www.isab.org/sab04/ ----- Call for participation ----- We are glad to announce that the registration for SAB2004 is now open, and that the preliminary technical program is available. See http://www.isab.org/sab04/register/ and http://www.isab.org/sab04/program/ The deadline for early registration is 28 May 2004. ----- Call for abstracts ----- SAB2004 introduces a new feature: the Last-Minute-Results poster session. This special session will offer researchers in Adaptive Behavior the opportunity to present their most recent results at SAB2004 (http://www.isab.org/sab04/). The goal of this session is to provide an informal setting in which participants can reveal and discuss their latest results and developments at the time of the conference (13-17 July 2004). Researchers are invited to submit a two-page abstract describing recent results/developments. Abstracts should be sent electronically as a PDF file to the conference general email address, sab2004@isab.org, with "Last Minute Results" in the email Subject line. The call for abstracts is open to all (i.e. to people both with and without an accepted paper at the conference). There is a limit of one abstract/poster per participant as a first author. After review ...

Calling AIX System Calls From C
Under AIX the smallest binary I've been able to generate from the standard "Hello World" program is about 1648 bytes. I would like to try and get the executable even smaller, and I believe a large portion of that 1648 bytes is the libc setup code (crt.o?) and dynamic linker. Can anyone show me how to compile/link an executable under AIX that makes no reference to libc but instead calls the kreadv (?) system call directly to write "Hello World" to stdout? I have searched extensively with Google and there is very little information on making system calls directly from C under AIX. What little information I can find is almost nine years old cjs2895 <cjs2895@hotmail.com> wrote: c> Under AIX the smallest binary I've been able to generate from the c> standard "Hello World" program is about 1648 bytes. I would like to c> try and get the executable even smaller, and I believe a large portion c> of that 1648 bytes is the libc setup code (crt.o?) and dynamic linker. c> Can anyone show me how to compile/link an executable under AIX that c> makes no reference to libc but instead calls the kreadv (?) system c> call directly to write "Hello World" to stdout? c> I have searched extensively with Google and there is very little c> information on making system calls directly from C under AIX. What c> little information I can find is almost nine years old It looks like you can call arbitrary system calls fro...

Flash calling Php calling Perl
Background: I have a flash program that posts user enter data to a php program on the server. The php program then saves this data in a database and then uses system () to call the perl program which takes the data and generates a pdf file and thumbnail images. The php program, on completion of the perl program then sends a status back to flash telling it was done. Flash then calls the php script to get thes thumbnails for the view to see. This process can take 10 or more seconds on the perl side to complete. We are changing the flash aplication so that there is no need for it to display the thumbnails after posting the data over and I am looking for a way of having the php program just start the perl program but not wait for it to complete before sending back the status to flash. From all the possible PHP commands, exec(), shell_exec(), passthru() and system(), it seems that they all wait for the called program to finish, is there a way to just start the program and not wait for it to complete? The other method would be to send the results back to flash prior to calling the perl program and not care how long perl took to do its job. Would flush() and ob_flush() be sufficient to force this information out to flash (the only information being sent back is "result=saved" or "result=fail")? If this is not possible, then on the perl side (crossposted to comp.lang.perl.misc for this question), is there a way of having a script take the command line argumen...

how to add new kernel call ? (not system call)
Hey all, i have already successfully added a system call to minix 3 but i would like to now add a kernel call. What i have done so far is : 1) added to /usr/src/kernel/system.c : map(SYS_MYCALL, do_mycall); 2) added to /usr/src/kernel/system.h : _PROTOTYPE( int do_mycall, (message *m_ptr) ); 3) added the do_mycall.c implementation file inside /usr/src/kernel/ system/ 4) added to Makefile inside /usr/src/kernel/system : $(SYSTEM)(do_mycall.o) \ (after the corresponding lines) $(SYSTEM)(do_mycall.o): do_mycall.c $(CC) do_mycall.c 5) added to /usr/src/include/minix/com.h #define SYS_MYCALL (KERNEL_CALL) + 31 #define NR_SYS_CALLS 32 ( instead of 31 which was the previous value ) 6) then i did : cd /usr/src make includes cd /usr/src/kernel/system make cd /usr/src/kernel make and here (at this last make) i get the following: /usr/lib/em_led: /usr/lib/i386//libc.a(exit.o): _exit: multiply defined (error) make in /usr/src/kernel: Exit code 1 So i am guessing i have forgotten to do something... Any directions ? > So i am guessing i have forgotten to do something... Any directions ? Just a general comment: it is easiest to use the Makefile in /usr/src/tools to build and install the operating system. It will do all these things in the right sequence. To make sure that everything is rebuit i always use "make fresh install" there, but in principle "fresh" should not be needed in your case. On Mar 18, 12:07=A0am, "Er...

CALL OF DOODY mod for Call of Duty 2
This is a mod I made for the PC version of the videogame Call of Duty 2. It replaces your old weapons with poop fueled variants, and updates the initial training mission appropriately. Functionally the weapons are unchanged, only kills are much more satisfying knowing that you're killing someone with human feces. The technology was invented by Nazi scientist Dr. Poopenhaus Fartenkraagr but was suppressed by Adolph Hitler because it was "too smelly." However the Allied forces got hold of this crappy new technology and have realized its destructive potential. They have begun arming their forces with poop enabled weapons, and the Axis forces have responded in kind. Be warned that the use of these weapons is known to cause horrendous rancid gas and explosive diarrhea. Soldier, it's time to answer the call of nature...the call of doody. temporary website: http://www.geocities.com/josiahseviltwin/ if anyone can provide a mirror it would be greatly appreciated! contact josiahsuarez(at)hotmail.com or JosiahsEvilTwin on AIM ...

what is it called?
Hi All, I can't remember what it is called but I know it did have a name I thought I remembered it as a 'cascading event' but I don't think that's what it really is called. senario: your primary key has dups so when you create a query which joins the primary key in the header to the forgien key in the detail you get bogus results, you get a set of detail of each header record. thanks bobh. bobh wrote: > Hi All, > > I can't remember what it is called but I know it did have a name I > thought I remembered it as a 'cascading event' but I don't think > that's what it really is called. It might be called a mistake. > > senario: > your primary key has dups so when you create a query which joins the > primary key in the header to the forgien key in the detail you get > bogus results, you get a set of detail of each header record. How can a primary key have duplicates...unless you set it up that way as to being a primary key and allowing duplicates? But then it would not be a primary key...a key that makes that row unique. > > thanks > bobh. > On Sep 5, 12:04 pm, Salad <o...@vinegar.com> wrote: > bobh wrote: > > Hi All, > > > I can't remember what it is called but I know it did have a name I > > thought I remembered it as a 'cascading event' but I don't think > > that's what it really is called. > > It might be called a mistak...

Should I call C from LabVIEW or call LabVIEW from C?
I need to write some software and am trying to choose the best development environment. I currently use Borland C++ Builder to develop most of my software and have also used some LabVIEW occasionally. The new package I need to write has to provide several functions, some of which would be better in C++, some in LabVIEW and I am wondering whether to combine the two. So far, I have had a quick play around and called a very basic piece LabVIEW code, built into a dll, from some C++ code. I am about to try to reverse (create dll in C++ and call from LabVIEW) but would appreciate some advice on the advantages/disadvantages of each method. &nbsp; Restrictions I have: 1. I will (probably) be using some hardware which will be supplied with C++ driver functions only. My interface with this card is the 'heart' of my system and is time-critical. Also, I need to assign a pointer to pass to this card (could I do this in LabVIEW?) 2. I wish to analyse data from the card using FFT and related functions so would ideally use the LabVIEW Sound &amp; Vibration and Order Analysis toolkits. I need to use these in real-time where the data sampling rate is fairly high (frequency analysis to be done on 4 channels at once with each channel sampled at approx 100kHz). &nbsp; To add to this, I would like to be able to create/modify the display screen at run-time - something which I am fine with in C++ but understand is very difficult in LabVIEW (I have only used LabVIEW for relatively...

calling labview dll from fortran lf95
I have a huge legacy app. written in Leahy LF95 fortran. I have GPIB instruments that I want to communicate using Labview from within the fortran code. I have created a labview 8.5 dll with my GPIB functions. I call them from the fortran app. Everything compiles and links just fine. I go to run the app and everything is fine until the call to Labview Runtime engine. I get a generic Error 998 blah blah blah runtime engine problem. This is a National Instruments error message&nbsp;NOT Fortran. I tried creating a MS VC++ 6.0 wrapper dll that simply calls the Labview dll thinking it might be an interface problem. Same error. I am very frustrated at this point and question the viability of Labview in any of my future projects that involve Fortran which is a huge # of projects. Hi BoeingJR, This is not a LabVIEW error, but rather is related to the way the DLL is being called.&nbsp; Please see these links for more info:KB:<a href="http://digital.ni.com/public.nsf/allkb/FD1B1D686A85471686256FC700605F60?OpenDocument" target="_blank">Why Do I Get Error 998 when I Try to Call a DLL in LabVIEW?</a> Related forum post: <a href="http://forums.ni.com/ni/board/message?board.id=170&amp;message.id=26765&amp;requireLogin=False" target="_blank">I get error 998 when calling a LabVIEW buildt DLL from MSVC++</a> Hope this helps. Thanks for the input...there is something squirrley about the Labview Run Time Engine. I r...

Call Manager Express
I've just installed a new CME system using 8 FXO ports to connect to the PSTN. Everything works great except for one minor problem when dialing out - all outgoing calls have a 7-12 second delay before connecting. For example, I pick up a phone, dial 9 to get out, then 987-6543, then silence for 7-12 seconds. The call eventually rings and connects, but the delay is confusing to users. Any help is appreciated. Thanks, Dave. dial-peer voice 1 pots destination-pattern 9T port 0/1/1 prefix 9, ! dial-peer voice 2 pots preference 1 destination-pattern 9T port 0/1/0 prefix 9, ! dial-peer voice 3 pots preference 2 destination-pattern 9T port 0/0/3 prefix 9, ! dial-peer voice 4 pots preference 3 destination-pattern 9T port 0/0/2 prefix 9, ! dial-peer voice 20 voip destination-pattern 2... session protocol sipv2 session target ipv4:xxx.xxx.xxx.xxx dtmf-relay sip-notify codec g711ulaw no vad ! ! ! telephony-service load 7960-7940 P00307020200 max-ephones 72 max-dn 72 ip source-address xxx.xxx.xxx.xxx port 2000 system message CME create cnf-files version-stamp 7960 Oct 16 2007 15:29:37 voicemail 2000 max-conferences 8 gain -6 dn-webedit time-webedit transfer-system full-consult secondary-dialtone 9 Your patterns are very generic and 9T gives no indication of when enough digits have been received. You need to either put in specific patterns, so that cme knows when you've finished dialing, or you can just press # after dialing. You can a...

Calling FORTRAN from Microsoft Visual C++ (2005)
Hi, I'm trying to do a trivial test of a C++ main calling a FORTRAN static liband I am getting a linker error I cannot get around. Here's the source code and linker error: extern "C" { void __stdcall tfort_ (int&, float&); } int _tmain(int argc, _TCHAR* argv[]) { int a=5; float b=1.2345f; tfort_(a,b); return 0; } C TEST FORTRAN SUBROUTINE TFORT(A, B) INTEGER A REAL B WRITE(UNIT=*, FMT=*)'A = ', A, ' B = ',B RETURN END 1>Compiling... 1>TestC.cpp 1>Linking... 1>TestC.obj : error LNK2019: unresolved external symbol _tfort_@8 referenced in function _wmain 1>C:\Mainframe\MainframePort\Debug\TestC.exe : fatal error LNK1120: 1 unresolved externals 1>Build log was saved at "file://c:\Mainframe\MainframePort\TestC\Debug \BuildLog.htm" 1>TestC - 2 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== I have tried different variations of the underscore placement and capitilization of the TFORT routine in the C++ code to no avail. Is there a compiler option I need? (I am using the Intel FORTRAN compiler). Any help would be greatly appreciated! On 25/04/2012 13:37, Mark wrote: > extern "C" > { > void __stdcall tfort_ (int&, float&); > } > > > int _tmain(int argc, _TCHAR* argv[]) > { >...

Excel calls an Access query that itself calls a VB Function
I am having a lot of trouble with a query that I am trying to call from Excel. As far as I can tell, the problem has to do with the fact that my Access Query actually uses a VB function that I created. For some reason, this two-step approach is causing a few different errors. Most consistently, I get: Run-time error '3085' Application-defined or object-defined error Does anyone know how to avoid this conflict? Thx J == Here are the relevant codes: Access Function used in query "Fees": ======================================== Function FeeRate(ItemAmt, qIssuer) 'this function looks up relevant fee levels by client Dim FeeTbl As String Dim FeeLvlMax FeeTbl = "Fees" 'each issuer/client can have a graduated fee structure based on levels of transactions 'this function will look for the level that the selected transaction applies to FeeLvlMax = DMin("[End]", FeeTbl, "[End] > " & ItemAmt & " AND [Issuer_Tag] = '" & qIssuer & "'") FeeRate = DLookup("[Fee]", FeeTbl, "[End] = " & FeeLvlMax) End Function And then - the Excel code calling the query: =============================================== 'This sub will pass two parameters to QueryDef in the Reconciliation Mirror 'database and place the results on Sheet1. Dim Db As Database Dim Qd As QueryDef Dim Rs As Recordset Dim Ws As Object Dim i As Integer Dim FirstDate As ...

call template function called from another xml file?
Hi, if I want to include a set of call template methods into my xsl file can I do that? Meaning I want to have the template method below of data_output in another file that I can use in several other xsl files when needed. This would be similar to an inclue mindset in C++ or a import in java. Any help is greatly appreciated. Below I would like the "data_output" template call to be imported so to speak or come from another xsl file, can this be done using the document method? <xsl:template match="//item[@key='SUMMARY']/*/item[@key='non_viewable']/*/item[@key='aggregate_result'][text()='true']"> <xsl:call-template name="data_output"/> </xsl:template> <!-- data output --> <xsl:template name="data_output"> <tr> <xsl:for-each select="ancestor::hashref/item[@key='viewable']/hashref/item"> <a> <xsl:attribute name="href"> http://lx-dgdev51:8080/cgi-bin/<xsl:value-of select="/perldata/arguments/display_cgi"/>?file=<xsl:value-of select="/perldata/arguments/file"/>&amp;xsl=<xsl:value-of select="/perldata/arguments/target_xsl"/>&amp;test=<xsl:value-of select="../../../item[@key='non_viewable']/hashref/item[@key='test_value']"/> </xsl:attribute> <th align='left' bgcolor="lightblue"> <font color...

Calling Linux system calls without risk of stalling?
In a multicore processor running Linux, one of the cores (say core 1) only runs one program/process and this program/process do various Linux system calls. This program/process has to execute as fast as possible and should not risk stalling/blocking on any spinlocks in the Linux kernel as result of doing the Linux system calls. What would be a safe implementation to solve this "problem" of risking to "stall" on a system call for the "stall free" program on core 1? Would a good implementation be to have a relay process/thread on another core (than core 1) which the "stall free" program/process has a lock free communication channel with (via shared memory for example)? Then the "stall free" program can place system call requests via the shared memory to the relay process on the other core, and tnhe relay process executes the system calls on behalf of the "lock free" program/ process, and also returns the result in the shared memory. Or are there other better ways to solve this? Brs dspfun wrote: > This program/process has to execute as fast as possible and should not > risk stalling/blocking on any spinlocks in the Linux kernel as result > of doing the Linux system calls. [ - cut -] > Or are there other better ways to solve this? Maybe you should look for linux RT and the people involved with it. Your problem looks like a realttime-problem. Ciao Nobbe ...

Is there a limit of mssql_bind calls you can make when calling mssql_execute?
It seems that the maximum number of parameters I can bind using mssql_bind and an execute statement is 30. If we go beyond we get an error of "mssql_execute(): could not retrieve results". Can anyone confirm that this is a limitation (of PHP4 or of MSSQL 2000) and if so, can it be modified? When we use mssql_query we can go beyond 30 parameters. Unfortunately there is a case where using mssql_query is not an option. Thanks, Greg There is a bug in MSSQL Client Libraries that avoid sending varchar parameters for more than 255 characters to a stored procedure. Use mssql_query instead. http://ie2.php.net/manual/en/function.mssql-bind.php Could this be the reason? It doesn't seem to be the problem since we've duplicated it with many different stored procedures and they always fail on the 31st parameter added. ...

Techrights Watch: Roy calls people libelous for calling out his BS
<http://techrights.org/wp-content/uploads/2011/09/irc-log-social-1092011.htm l> MinceR: ----- schestowitz: we have the apple troll on #techbytes ----- Schestowitz: ----- when he starts trolling, which he will, he'll probably be booted That dunce is very mentally disturbed But IMHO, he helps bring more people to the site, oddly enough He can't help himself ----- MinceR: ----- how? ----- Schestowitz: ----- How what? He helps the site? schestowitz The trolling is not helping But he absorbs people who hate us and then channels them to the site\ He doesn't know it's ineffective, the best he could do was to ignore ----- Schestowitz: ----- The Badgeware/Brandware company known as "Apple" is a major competitor of Linux. GNU/Linux is not just a desktop platform and this forum is not about desktops. either. It is funny to see how anti-Linux trolls who infiltrated this newsgroup somehow act all shocked and surprised that Apple is put down in a forum that compares Linux to other operating systems. Wait, what?!?! How dare it compare!!! Maybe they feel a little envious because their little SCO wannabe, Microsoft, does not get as much attention as it used to. Personally, I no longer track Microsoft because it's dying on its own; it doesn't need much of a shove. Microsoft will be like SUN in 5-10 years, only ...

IEEE SP Magazine Call For Call for Articles on DSP Patents
IEEE Signal Processing Magazine Call for Articles on DSP Patents IEEE Signal Processing Magazine will publish a new column called DSP Patents. Technical patents are often written in terms of claims and legal jargons. Technical oriented readers often find it difficult to understand the real technical issues addressed by a given patent. The objective of this column is to review newly issued DSP-related patents and their applications using a style that is easily understandable by a DSP engineer. It is required that each article will cover the following aspects of a patent: 1. Problem statement: What problem is addressed in this invention and why is it important? 2. Prior art: What have been done so far, and why existing solutions are insufficient? 3. Technical description: Describe, in easily understood style, the solution presented in this invention. 4. Claims: In technical terms, explain the originality contribution of the proposed solution that is protected by this patent. 5. Comments: Discuss possible alternate solutions that may serve similar functions and possible future innovations. The length of the article is limited to one to two printed pages (up to six double-space type-written pages). The authors could be either the inventors of the patent or experts in the related areas. If the authors are inventors, the article will be reviewed by a thirty party expert and the editor. If the authors are not inventors of the patent, the article will be forwarded to inven...

Calling C++ DLL from FORTRAN ... Application failed to initialize properly
I have this dll that I wrote in VC++.NET. I've exported some functions that I know work when called from C++, VB, VBA, HTML (when I regasm(ed) it). So it works ... but they want me to call it from FORTRAN, writen in Intel Fortran. When I try to run the fortran code, I get "Application failed to initialize properly (0xc0000142) Click on OK to terminate the program" Here's what I have ... In my *.h file I have ... extern "C" { __declspec(dllimport) void __stdcall IterateInputFile(String*); __declspec(dllimport) void __stdcall IterateInputArray(double*, double*); } In my *.cpp file I have ... void __stdcall IterateInputFile(String* FilePath) { STWT::CSTWT* ws = __gc new STWT::CSTWT(); ws->Iterate1(FilePath); FilePath = FilePath->Replace(S".xml",S".out.xml"); ws->OnFileSaveXml(FilePath); } void __stdcall IterateInputArray(double* InputArray, double* OutputArray) { STWT::CSTWT* ws = __gc new STWT::CSTWT(); ws->Iterate2(InputArray); ws->PopulateOutputArray(&OutputArray[0]); } in my FORTRAN project settings .... Additional Dependancies = "$(OUTDIR)/STWT.lib" (the lib and dll is located with the f90 exe file) and .. in my *.f90 file, I have .... program STWT_FORTRAN implicit none REAL *8 Input(92) REAL *8 Output(56) character(len=256) FileName interface subroutine IterateInputArray(InputArray,OutputArray) !DEC$ ATTRIBUTES STDCALL, DLLIMPORT, alias: "_IterateInpu...

C system() call failing in print app called by Samba
Hi, I have an embedded Linux device running on a Cirrus Logic EP9301 ARM, Linux kernel version 2.6.20.4m1. It is configured as a Samba print share. Instead of printing a file from a Windows client, we have print command set to call a custom application that is supposed to upload the file to an SFTP server. In my C++ application, I wrapped the appropriate command in a system() call. The application works perfectly when I call it from a command line terminal. The problem arises when I have it called from Samba. The problem is that the system call always fails. I can see my application running with the appropriate parameters via syslog entries. To simplify debugging, I replaced the C++ program called by Samba with a very simple C program that makes 2 system calls: one to env (which pipes the results to a log file) and the other to beep, a custom app that beeps the speaker in our target. Again, running directly from the command line, it works correctly. It fails, however, when executed via Samba. Here is the code snippet: ------------------ char Cmd[200]; int RetVal; sprintf(Cmd, "/usr/bin/env >> /tmp/env.log"); printf("%s\n", Cmd); WriteSyslog("%s", Cmd); RetVal = system(Cmd); printf("system call result = %d\n", RetVal); WriteSyslog("system call result = %d", RetVal); sprintf(Cmd, "beep 4"); printf("%s\n", Cmd); WriteSyslog("%s", Cmd); RetVal = system(Cmd...

msaccess.exe API calls: where to get the function call description
Hello, I have a problem with one of msaccess.exe API calls that work on my desctop but does not work on the laptop from within MS ACCESS. There is a lot of differences between 2 computers including one running Office 2000 and another running Office 2003. This code was created by a previous developer. I need to find the description and parameters of the API calls. I found the article http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnofftalk/html/Office03082001.asp Office VBA and the Windows API that says that I should use Win32.API.txt that I don't have on my computer or I should install The Microsoft Platform SDK, which contains complete documentation for the Windows API. I installed that, but could not find functions for MS ACCESS. Please, let me know where to look for the function call description for MS ACCESS API functions. Another question is: why this fuction when called from Access 2000 does accept hexadecimal value and when called from Access 2003 it does not accept hexadecimal value for the Registry Hive. Basically I will be grateful for the input format of all parameters. The function definition is: Declare Function adh_accRegWriteVal Lib "msaccess.exe" Alias "#71" _ (ByVal hkeyRoot As Long, ByVal strSubKey As String, ByVal strValName As String, _ lpData As Any, ByVal lngType As Long) As Long Thanks in advance for any help, -- Regards, Yelena Varshal Message posted via http://www.accessmonster.com "Yelena Va...

Web resources about - mex - matlab calls fortran which calls matlab which calls fortran - is it possible? - comp.soft-sys.matlab

Diana Taurasi on Idea of Lowering Rims in Women’s Basketball: “Might as well put us in skirts and back ...
In a recent interview with For The Win , Chicago Sky Star Elena Delle Donne discussed whether she thought lowering the rims in Women’s Basketball ...

FBI Agrees to Help Arkansas Prosecutor Unlock iPhone and iPod in Homicide Case
The FBI has agreed to help an Arkansas prosecutor unlock an iPhone and iPod that belong to two teenagers accused of killing a couple, reports ...

Police will not be charged in Minneapolis death of black man
Two Minneapolis police officers involved in the shooting death of a 24-year-old black man will not be charged, prosecutors said on Wednesday, ...

‘Batman v Superman’ Meets ‘Bridget Jones’ in Trailer Mash-Up
An epic trailer meshing scenes from “Batman v Superman: Dawn of Justice” with the upcoming rom-com “Bridget Jones’s Baby” debuted on “Jimmy Kimmel ...

Mississippi Senate Passes ‘Worst Religious Freedom Bill To Date’ in the US
The Mississippi Senate has passed an anti-LGBT bill that has been described as “probably the worst religious freedom bill to date” to be considered ...

Russell apologizes for taking video of Lakers teammate Young
EL SEGUNDO, Calif. (AP) — D'Angelo Russell believes he must rebuild the Los Angeles Lakers' trust in him after the rookie guard's unflattering ...

Foxconn Takes Control of Sharp
Foxconn Technology Group, the world’s largest contract maker of consumer electronics, announced on on Wednesday that they have officially acquired ...

Amazon Updates Its Policies To Ban USB Type-C Cables That Are Not Fully Spec Compliant
Ryan Whitwam / Android Police : Amazon Updates Its Policies To Ban USB Type-C Cables That Are Not Fully Spec Compliant — Googler Benson Leung ...

Review: ‘Star Wars Rebels’ Takes Dark Turn in Dazzling Season Finale
First Lucasfilm and now parent Disney have been clever about using animation as a means to keep the “Star Wars” franchise alive between movies. ...

President Obama issues 61 sentence commutations, only 10,000 more to go
Today, President Obama met with Americans who have received commutations on prison sentences during his presidency, and under previous administrations. ...

Resources last updated: 3/31/2016 3:19:46 AM