source: Sophya/trunk/SophyaProg/Tests/tcxxcmpldynl.cc@ 2694

Last change on this file since 2694 was 2615, checked in by cmv, 21 years ago

using namespace sophya enleve de machdefs.h, nouveau sopnamsp.h cmv 10/09/2004

File size: 1.5 KB
Line 
1#include <stdio.h>
2#include <stdlib.h>
3#include <math.h>
4#include <iostream>
5
6#include "sopnamsp.h"
7#include "histinit.h"
8#include "array.h"
9#include "cxxcmplnk.h"
10#include "pdlmgr.h"
11#include "timing.h"
12
13int main(int narg, char *arg[])
14{
15 if (narg < 3) {
16 cout << " tcxxcmpldynl : test of CxxCompilerLinker and PDynLinkMgr classes \n "
17 << " Usage tcxxcmpldynl nomCC nomFunc \n"
18 << " For test, tcxxcmpldynl exacmplnk.cc exacmplnk \n" << endl;
19 exit(0);
20 }
21 try {
22 SophyaInit();
23 InitTim();
24
25 string flnm = arg[1];
26 string oname, soname;
27 int rc;
28
29 CxxCompilerLinker cxx(true, false, false);
30 cxx.SetVerbose(true);
31 rc = cxx.Compile(flnm, oname);
32 cout << " RC from cxx.Compile() = " << rc << " oname= " << oname << endl;
33 rc = cxx.BuildSO(oname, soname);
34 cout << " RC from cxx.BuildSO() = " << rc << " soname= " << soname << endl;
35 PrtTim(" End of Compile-Link ");
36
37 string funcname = arg[2];
38 PDynLinkMgr dyl(soname, false);
39 DlFunction f = dyl.GetFunction(funcname);
40 if (f != NULL) {
41 cout << " DlFunction f linked OK - calling f() ... " << endl;
42 f();
43 }
44 else {
45 cout << " ERROR linking DlFunction f !!! " << endl;
46 }
47 }
48
49 catch (PThrowable & exc) {
50 cerr << " Catched Exception " << (string)typeid(exc).name()
51 << " - Msg= " << exc.Msg() << endl;
52 }
53 catch (...) {
54 cerr << " some other exception was caught ! " << endl;
55 }
56
57 PrtTim(" End of tcxxcmpldynl ");
58}
Note: See TracBrowser for help on using the repository browser.