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