XANSYS Forum Index
    Register    

FAQ    Search    Memberlist    Usergroups    SmartFeedSmartFeed    Profile    Log in
[Xansys] [ADPL] ADPL and UPF in Window XP 32bit.
 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    XANSYS Forum Index -> XANSYS
Author Message
wonjae.lee
User


Joined: 22 Jun 2011
Posts: 6

PostPosted: Wed Jun 22, 2011 2:06 am  Reply with quote

I'm trying to use UPF in Windows XP 32bit.

I use ANSYS 12.1
and MS Visual studio 2005.

i did exactly what programmer's manual for mechanical ADPL Appendix B.

but i think it won't work.

1. i just make Visual studio 2005 win32 dll project.
2. include ANSYS.lib
3. inlucd "CAnsQuery.h", "AnsInterface.h"
4. Here is my C_Code.

/------------------------------------------------------------------------------------
#include <windows.h>
#include "ans_shared.h"
#include "cAnsQuery.h"
#include "cAnsInterface.h"
//#include "cAnsPick.h"

#ifdef _MANAGED
#pragma managed(push, off)
#endif

/*
------------------------------ Function Description -----------------------
extfnc
int extfnc(uecmd)
char *uecmd;

Purpose:

Demonstrate C API entry function for an external command.

Parameters:

Input
-----------------------------
uecmd
The ANSYS external command string.

Output
-----------------------------

Return Value:
The return value is ignored by the calling function;

----------------------------- End Function Description --------------------
*/

int extfnc(char* uecmd)
{
/* Note: uecmd is the entire command given to invoke this function */
char* cmdsend = {"/COM, COMMAND SENT FROM EXTERNAL COMMAND"};
char* querystr = {"NODE,,NUM,MAX"};
char strrtn[32];
int i, itype;
double dblrtn;

/* Send a simple command to be executed */
i = cAnsSendCommand(cmdsend);

/* Perform a simple query */
// i = cAnsGetValue(querystr,&dblrtn,strrtn,&itype);

/* Display the value retrieved */
cAns_printf("Max Node Number = %g\n",dblrtn);

return (i);
}
/------------------------------------------------------------------------------------

It was compiled and make DLL files.
the DLL which was maden is test.dll

5. i made test.def file

EXPORTS

extfunc

6. i modified ANS_EXT.TBL in C:\Program Files\Ansys Inc\v121\ansys\lib\intel
and it's content is

%ANSYS121_DIR%\Lib\Intel\test.dll ~extfnc extfnc

I started Launcher and job name was test and directory was e:\ansys
then i copied test.def to e:\ansys

after launch ansys
i typed ~DEBUG

and i found

command library function accessed?
~extfnc c:\Program~\intel\test.dll test.dll no

i tired typing ~extfnc
but there is a error
"An error was detected while operation on a shared library:"

What did i wrong??

and
if i try to use "cAnsGetValue(querystr,&dblrtn,strrtn,&itype); " function
there was a link error
"Unresolved external symbol"

Do i have to include another lib files?

Is there anyone use only C/C++ for using UPF?

wonjae lee. korea aviation univ. KOREA.
Back to top
View user's profile Send private message Send e-mail
Martin Liddle
User


Joined: 15 Aug 2008
Posts: 1274
Location: Chesterfield, UK

PostPosted: Wed Jun 22, 2011 2:45 am  Reply with quote

On 22/06/2011 10:06, wonjae.lee wrote:

> What did i wrong??
>
Failed to include you name and company (or university if still a
student) on your posting. You have been a member for less than an hour
and this is the second time you have demonstrated your inability to
follow simple instructions. Be very careful to conform to the rules and
conventions of XANSYS in future.


--
Martin Liddle, XANSYS Moderator, Tynemouth Computer Services,
Chesterfield, Derbyshire, UK.
www.tynecomp.co.uk

Post generated using Mail2Forum (http://www.mail2forum.com)
_________________
Martin Liddle, Tynemouth Computer Services,
Chesterfield, UK.
Back to top
View user's profile Send private message Visit poster's website
matt.sutton
User


Joined: 21 Oct 2008
Posts: 134

PostPosted: Wed Jun 22, 2011 6:47 am  Reply with quote

Here are some things to try, which may or may not work. First, try wrapping your function in an extern "C" statement, if you are compiling the code with the c++ compiler. This will tell the compiler to use C linkage, otherwise it might be mangling the function name. You also might want to include the dllexport statement. As far as unresolved externals, you might try linking against ansyslib.lib as well. Something like:
extern "C" {
__declspec(dllexport) int extfnc(char* uecmd)
{
// Your code
}
}




We Bring Dimension To Your Ideas
Matthew Sutton
Lead Engineer, Software Development
Specialist Engineer
Phoenix Analysis & Design Technologies
7755 S. Research Dr, Suite 110
Tempe, AZ 85284
matt.sutton@padtinc.com
480-813-4884 x106 W
602-722-4622 M
480-813-4807 F
Simulation - Product Development - Rapid Prototyping
www.PADTINC.com
CONFIDENTIALITY NOTICE: This e-mail message and any attachments are for the sole use of the intended recipient(s) and may contain confidential and/or privileged information. Unless you are the intended recipient, you are hereby notified that copying, forwarding, printing or otherwise disseminating the information contained in or attached to this e-mail is strictly prohibited. If you are not the intended recipient, please notify the sender by telephone, and immediately and permanently delete and destroy all copies and printouts of this e-mail message and/or attachments.


-----Original Message-----
From: wonjae.lee [mailto:wjlee@ensoft21.co.kr]
Sent: Wednesday, June 22, 2011 2:06 AM
To: xansys@xansys.org
Subject: [Xansys] ADPL and UPF in Window XP 32bit.

I'm trying to use UPF in Windows XP 32bit.

I use ANSYS 12.1
and MS Visual studio 2005.

i did exactly what programmer's manual for mechanical ADPL Appendix B.

but i think it won't work.

1. i just make Visual studio 2005 win32 dll project.
2. include ANSYS.lib
3. inlucd "CAnsQuery.h", "AnsInterface.h"
4. Here is my C_Code.

/------------------------------------------------------------------------------------
#include <windows.h>
#include "ans_shared.h"
#include "cAnsQuery.h"
#include "cAnsInterface.h"
//#include "cAnsPick.h"

#ifdef _MANAGED
#pragma managed(push, off)
#endif

/*
------------------------------ Function Description -----------------------
extfnc
int extfnc(uecmd)
char *uecmd;

Purpose:

Demonstrate C API entry function for an external command.

Parameters:

Input
-----------------------------
uecmd
The ANSYS external command string.

Output
-----------------------------

Return Value:
The return value is ignored by the calling function;

----------------------------- End Function Description --------------------
*/

int extfnc(char* uecmd)
{
/* Note: uecmd is the entire command given to invoke this function */
char* cmdsend = {"/COM, COMMAND SENT FROM EXTERNAL COMMAND"};
char* querystr = {"NODE,,NUM,MAX"};
char strrtn[32];
int i, itype;
double dblrtn;

/* Send a simple command to be executed */
i = cAnsSendCommand(cmdsend);

/* Perform a simple query */
// i = cAnsGetValue(querystr,&dblrtn,strrtn,&itype);

/* Display the value retrieved */
cAns_printf("Max Node Number = %g\n",dblrtn);

return (i);
}
/------------------------------------------------------------------------------------

It was compiled and make DLL files.
the DLL which was maden is test.dll

5. i made test.def file

EXPORTS

extfunc

6. i modified ANS_EXT.TBL in C:\Program Files\Ansys Inc\v121\ansys\lib\intel
and it's content is

%ANSYS121_DIR%\Lib\Intel\test.dll ~extfnc extfnc

I started Launcher and job name was test and directory was e:\ansys
then i copied test.def to e:\ansys

after launch ansys
i typed ~DEBUG

and i found

command library function accessed?
~extfnc c:\Program~\intel\test.dll test.dll no

i tired typing ~extfnc
but there is a error
"An error was detected while operation on a shared library:"

What did i wrong??

and
if i try to use "cAnsGetValue(querystr,&dblrtn,strrtn,&itype); " function
there was a link error
"Unresolved external symbol"

Do i have to include another lib files?

Is there anyone use only C/C++ for using UPF?






+-------------------------------------------------------------+
| XANSYS web - www.xansys.org/forum |
| The Online Community for users of ANSYS, Inc. Software |
| Hosted by PADT - www.padtinc.com |
| Send administrative requests to xansys-mod@tynecomp.co.uk |
+-------------------------------------------------------------+

Post generated using Mail2Forum (http://www.mail2forum.com)
Back to top
View user's profile Send private message
wonjae.lee
User


Joined: 22 Jun 2011
Posts: 6

PostPosted: Wed Jun 22, 2011 6:01 pm  Reply with quote

Dear Matthew Sutton.

Thanks a lot!!!
It works!!

But i have still have unresolved error for CAnsGetValue even though i linked ansyslib.lib.
Do i need copy any dll files into my project directory?

Wonjae. lee.
Hankuk aviation univ.
KOREA.


[quote="matt.sutton"]Here are some things to try, which may or may not work. First, try wrapping your function in an extern "C" statement, if you are compiling the code with the c++ compiler. This will tell the compiler to use C linkage, otherwise it might be mangling the function name. You also might want to include the dllexport statement. As far as unresolved externals, you might try linking against ansyslib.lib as well. Something like:
extern "C" {
__declspec(dllexport) int extfnc(char* uecmd)
{
// Your code
}
}




We Bring Dimension To Your Ideas
Matthew Sutton
Lead Engineer, Software Development
Specialist Engineer
Phoenix Analysis & Design Technologies
7755 S. Research Dr, Suite 110
Tempe, AZ� 85284
matt.sutton@padtinc.com
480-813-4884 x106 W
602-722-4622 M
480-813-4807 F
Simulation - Product Development - Rapid Prototyping
www.PADTINC.com
CONFIDENTIALITY NOTICE: This e-mail message and any attachments are for the sole use of the intended recipient(s) and may contain confidential and/or privileged information.� Unless you are the intended recipient, you are hereby notified that copying, forwarding, printing or otherwise disseminating the information contained in or attached to this e-mail is strictly prohibited. If you are not the intended recipient, please notify the sender by telephone, and immediately and permanently delete and destroy all copies and printouts of this e-mail message and/or attachments.�


-----Original Message-----
From: wonjae.lee [mailto:wjlee@ensoft21.co.kr]
Sent: Wednesday, June 22, 2011 2:06 AM
To: xansys@xansys.org
Subject: [Xansys] ADPL and UPF in Window XP 32bit.

I'm trying to use UPF in Windows XP 32bit.

I use ANSYS 12.1
and MS Visual studio 2005.

i did exactly what programmer's manual for mechanical ADPL Appendix B.

but i think it won't work.

1. i just make Visual studio 2005 win32 dll project.
2. include ANSYS.lib
3. inlucd "CAnsQuery.h", "AnsInterface.h"
4. Here is my C_Code.

/------------------------------------------------------------------------------------
#include <windows.h>
#include "ans_shared.h"
#include "cAnsQuery.h"
#include "cAnsInterface.h"
//#include "cAnsPick.h"

#ifdef _MANAGED
#pragma managed(push, off)
#endif

/*
------------------------------ Function Description -----------------------
extfnc
int extfnc(uecmd)
char *uecmd;

Purpose:

Demonstrate C API entry function for an external command.

Parameters:

Input
-----------------------------
uecmd
The ANSYS external command string.

Output
-----------------------------

Return Value:
The return value is ignored by the calling function;

----------------------------- End Function Description --------------------
*/

int extfnc(char* uecmd)
{
/* Note: uecmd is the entire command given to invoke this function */
char* cmdsend = {"/COM, COMMAND SENT FROM EXTERNAL COMMAND"};
char* querystr = {"NODE,,NUM,MAX"};
char strrtn[32];
int i, itype;
double dblrtn;

/* Send a simple command to be executed */
i = cAnsSendCommand(cmdsend);

/* Perform a simple query */
// i = cAnsGetValue(querystr,&dblrtn,strrtn,&itype);

/* Display the value retrieved */
cAns_printf("Max Node Number = %g\n",dblrtn);

return (i);
}
/------------------------------------------------------------------------------------

It was compiled and make DLL files.
the DLL which was maden is test.dll

5. i made test.def file

EXPORTS

extfunc

6. i modified ANS_EXT.TBL in C:\Program Files\Ansys Inc\v121\ansys\lib\intel
and it's content is

%ANSYS121_DIR%\Lib\Intel\test.dll ~extfnc extfnc

I started Launcher and job name was test and directory was e:\ansys
then i copied test.def to e:\ansys

after launch ansys
i typed ~DEBUG

and i found

command library function accessed?
~extfnc c:\Program~\intel\test.dll test.dll no

i tired typing ~extfnc
but there is a error
"An error was detected while operation on a shared library:"

What did i wrong??

and
if i try to use "cAnsGetValue(querystr,&dblrtn,strrtn,&itype); " function
there was a link error
"Unresolved external symbol"

Do i have to include another lib files?

Is there anyone use only C/C++ for using UPF?






+-------------------------------------------------------------+
| XANSYS web - www.xansys.org/forum |
| The Online Community for users of ANSYS, Inc. Software |
| Hosted by PADT - www.padtinc.com |
| Send administrative requests to xansys-mod@tynecomp.co.uk |
+-------------------------------------------------------------+

Post generated using Mail2Forum (http://www.mail2forum.com)[/quote]
Back to top
View user's profile Send private message Send e-mail
wonjae.lee
User


Joined: 22 Jun 2011
Posts: 6

PostPosted: Thu Jun 23, 2011 2:25 am  Reply with quote

Dear Matthew Sutton.

I tried with ansyslib.lib only.
then it looking for ifconsol.lib.

I don't have ifoncsol.lib and i found it is library of visual fortran.
Do i have to have visual fortran for ansys ADPL, UPF?
or can i use only VC++??

wonjae lee.
Korea aviation univ.
KOREA.


[quote="matt.sutton"]Here are some things to try, which may or may not work. First, try wrapping your function in an extern "C" statement, if you are compiling the code with the c++ compiler. This will tell the compiler to use C linkage, otherwise it might be mangling the function name. You also might want to include the dllexport statement. As far as unresolved externals, you might try linking against ansyslib.lib as well. Something like:
extern "C" {
__declspec(dllexport) int extfnc(char* uecmd)
{
// Your code
}
}




We Bring Dimension To Your Ideas
Matthew Sutton
Lead Engineer, Software Development
Specialist Engineer
Phoenix Analysis & Design Technologies
7755 S. Research Dr, Suite 110
Tempe, AZ? 85284
matt.sutton@padtinc.com
480-813-4884 x106 W
602-722-4622 M
480-813-4807 F
Simulation - Product Development - Rapid Prototyping
www.PADTINC.com
CONFIDENTIALITY NOTICE: This e-mail message and any attachments are for the sole use of the intended recipient(s) and may contain confidential and/or privileged information.? Unless you are the intended recipient, you are hereby notified that copying, forwarding, printing or otherwise disseminating the information contained in or attached to this e-mail is strictly prohibited. If you are not the intended recipient, please notify the sender by telephone, and immediately and permanently delete and destroy all copies and printouts of this e-mail message and/or attachments.?


-----Original Message-----
From: wonjae.lee [mailto:wjlee@ensoft21.co.kr]
Sent: Wednesday, June 22, 2011 2:06 AM
To: xansys@xansys.org
Subject: [Xansys] ADPL and UPF in Window XP 32bit.

I'm trying to use UPF in Windows XP 32bit.

I use ANSYS 12.1
and MS Visual studio 2005.

i did exactly what programmer's manual for mechanical ADPL Appendix B.

but i think it won't work.

1. i just make Visual studio 2005 win32 dll project.
2. include ANSYS.lib
3. inlucd "CAnsQuery.h", "AnsInterface.h"
4. Here is my C_Code.

/------------------------------------------------------------------------------------
#include <windows.h>
#include "ans_shared.h"
#include "cAnsQuery.h"
#include "cAnsInterface.h"
//#include "cAnsPick.h"

#ifdef _MANAGED
#pragma managed(push, off)
#endif

/*
------------------------------ Function Description -----------------------
extfnc
int extfnc(uecmd)
char *uecmd;

Purpose:

Demonstrate C API entry function for an external command.

Parameters:

Input
-----------------------------
uecmd
The ANSYS external command string.

Output
-----------------------------

Return Value:
The return value is ignored by the calling function;

----------------------------- End Function Description --------------------
*/

int extfnc(char* uecmd)
{
/* Note: uecmd is the entire command given to invoke this function */
char* cmdsend = {"/COM, COMMAND SENT FROM EXTERNAL COMMAND"};
char* querystr = {"NODE,,NUM,MAX"};
char strrtn[32];
int i, itype;
double dblrtn;

/* Send a simple command to be executed */
i = cAnsSendCommand(cmdsend);

/* Perform a simple query */
// i = cAnsGetValue(querystr,&dblrtn,strrtn,&itype);

/* Display the value retrieved */
cAns_printf("Max Node Number = %g\n",dblrtn);

return (i);
}
/------------------------------------------------------------------------------------

It was compiled and make DLL files.
the DLL which was maden is test.dll

5. i made test.def file

EXPORTS

extfunc

6. i modified ANS_EXT.TBL in C:\Program Files\Ansys Inc\v121\ansys\lib\intel
and it's content is

%ANSYS121_DIR%\Lib\Intel\test.dll ~extfnc extfnc

I started Launcher and job name was test and directory was e:\ansys
then i copied test.def to e:\ansys

after launch ansys
i typed ~DEBUG

and i found

command library function accessed?
~extfnc c:\Program~\intel\test.dll test.dll no

i tired typing ~extfnc
but there is a error
"An error was detected while operation on a shared library:"

What did i wrong??

and
if i try to use "cAnsGetValue(querystr,&dblrtn,strrtn,&itype); " function
there was a link error
"Unresolved external symbol"

Do i have to include another lib files?

Is there anyone use only C/C++ for using UPF?






+-------------------------------------------------------------+
| XANSYS web - www.xansys.org/forum |
| The Online Community for users of ANSYS, Inc. Software |
| Hosted by PADT - www.padtinc.com |
| Send administrative requests to xansys-mod@tynecomp.co.uk |
+-------------------------------------------------------------+

Post generated using Mail2Forum (http://www.mail2forum.com)[/quote]
Back to top
View user's profile Send private message Send e-mail
matt.sutton
User


Joined: 21 Oct 2008
Posts: 134

PostPosted: Wed Jul 06, 2011 2:22 pm  Reply with quote

Wonjae Lee,
The function you are looking for is exported in the library ansys.lib. I've verified that with the dumpbin.exe utility. I reread your first post and it is unclear to me if you just included that file in your project, or if you set up the linker to link against that library. You need to do the latter.
Regards,
Matt Sutton
www.padtinc.com


-----Original Message-----
From: wonjae.lee [mailto:wjlee@ensoft21.co.kr]
Sent: Thursday, June 23, 2011 2:25 AM
To: xansys@xansys.org
Subject: Re: [Xansys] [ADPL] ADPL and UPF in Window XP 32bit.

Dear Matthew Sutton.

I tried with ansyslib.lib only.
then it looking for ifconsol.lib.

I don't have ifoncsol.lib and i found it is library of visual fortran.
Do i have to have visual fortran for ansys ADPL, UPF?
or can i use only VC++??

wonjae lee.
Korea aviation univ.
KOREA.


matt.sutton wrote:
Here are some things to try, which may or may not work. First, try wrapping your function in an extern "C" statement, if you are compiling the code with the c++ compiler. This will tell the compiler to use C linkage, otherwise it might be mangling the function name. You also might want to include the dllexport statement. As far as unresolved externals, you might try linking against ansyslib.lib as well. Something like:
extern "C" {
__declspec(dllexport) int extfnc(char* uecmd)
{
// Your code
}
}




We Bring Dimension To Your Ideas
Matthew Sutton
Lead Engineer, Software Development
Specialist Engineer
Phoenix Analysis & Design Technologies
7755 S. Research Dr, Suite 110
Tempe, AZ? 85284
matt.sutton@padtinc.com
480-813-4884 x106 W
602-722-4622 M
480-813-4807 F
Simulation - Product Development - Rapid Prototyping
www.PADTINC.com
CONFIDENTIALITY NOTICE: This e-mail message and any attachments are for the sole use of the intended recipient(s) and may contain confidential and/or privileged information.? Unless you are the intended recipient, you are hereby notified that copying, forwarding, printing or otherwise disseminating the information contained in or attached to this e-mail is strictly prohibited. If you are not the intended recipient, please notify the sender by telephone, and immediately and permanently delete and destroy all copies and printouts of this e-mail message and/or attachments.?


-----Original Message-----
From: wonjae.lee [mailto:wjlee@ensoft21.co.kr]
Sent: Wednesday, June 22, 2011 2:06 AM
To: xansys@xansys.org
Subject: [Xansys] ADPL and UPF in Window XP 32bit.

I'm trying to use UPF in Windows XP 32bit.

I use ANSYS 12.1
and MS Visual studio 2005.

i did exactly what programmer's manual for mechanical ADPL Appendix B.

but i think it won't work.

1. i just make Visual studio 2005 win32 dll project.
2. include ANSYS.lib
3. inlucd "CAnsQuery.h", "AnsInterface.h"
4. Here is my C_Code.

/------------------------------------------------------------------------------------
#include <windows.h>
#include "ans_shared.h"
#include "cAnsQuery.h"
#include "cAnsInterface.h"
//#include "cAnsPick.h"

#ifdef _MANAGED
#pragma managed(push, off)
#endif

/*
------------------------------ Function Description -----------------------
extfnc
int extfnc(uecmd)
char *uecmd;

Purpose:

Demonstrate C API entry function for an external command.

Parameters:

Input
-----------------------------
uecmd
The ANSYS external command string.

Output
-----------------------------

Return Value:
The return value is ignored by the calling function;

----------------------------- End Function Description --------------------
*/

int extfnc(char* uecmd)
{
/* Note: uecmd is the entire command given to invoke this function */
char* cmdsend = {"/COM, COMMAND SENT FROM EXTERNAL COMMAND"};
char* querystr = {"NODE,,NUM,MAX"};
char strrtn[32];
int i, itype;
double dblrtn;

/* Send a simple command to be executed */
i = cAnsSendCommand(cmdsend);

/* Perform a simple query */
// i = cAnsGetValue(querystr,&dblrtn,strrtn,&itype);

/* Display the value retrieved */
cAns_printf("Max Node Number = %g\n",dblrtn);

return (i);
}
/------------------------------------------------------------------------------------

It was compiled and make DLL files.
the DLL which was maden is test.dll

5. i made test.def file

EXPORTS

extfunc

6. i modified ANS_EXT.TBL in C:\Program Files\Ansys Inc\v121\ansys\lib\intel
and it's content is

%ANSYS121_DIR%\Lib\Intel\test.dll ~extfnc extfnc

I started Launcher and job name was test and directory was e:\ansys
then i copied test.def to e:\ansys

after launch ansys
i typed ~DEBUG

and i found

command library function accessed?
~extfnc c:\Program~\intel\test.dll test.dll no

i tired typing ~extfnc
but there is a error
"An error was detected while operation on a shared library:"

What did i wrong??

and
if i try to use "cAnsGetValue(querystr,&dblrtn,strrtn,&itype); " function
there was a link error
"Unresolved external symbol"

Do i have to include another lib files?

Is there anyone use only C/C++ for using UPF?






+-------------------------------------------------------------+
| XANSYS web - www.xansys.org/forum |
| The Online Community for users of ANSYS, Inc. Software |
| Hosted by PADT - www.padtinc.com |
| Send administrative requests to xansys-mod@tynecomp.co.uk |
+-------------------------------------------------------------+







+-------------------------------------------------------------+
| XANSYS web - www.xansys.org/forum |
| The Online Community for users of ANSYS, Inc. Software |
| Hosted by PADT - www.padtinc.com |
| Send administrative requests to xansys-mod@tynecomp.co.uk |
+-------------------------------------------------------------+

Post generated using Mail2Forum (http://www.mail2forum.com)
Back to top
View user's profile Send private message
wonjae.lee
User


Joined: 22 Jun 2011
Posts: 6

PostPosted: Mon Jun 01, 2020 11:30 pm  Reply with quote

wonjae.lee wrote:
I'm trying to use UPF in Windows XP 32bit.

I use ANSYS 12.1
and MS Visual studio 2005.

i did exactly what programmer's manual for mechanical ADPL Appendix B.

but i think it won't work.

1. i just make Visual studio 2005 win32 dll project.
2. include ANSYS.lib
3. inlucd "CAnsQuery.h", "AnsInterface.h"
4. Here is my C_Code.

/------------------------------------------------------------------------------------
#include <windows.h>
#include "ans_shared.h"
#include "cAnsQuery.h"
#include "cAnsInterface.h"
//#include "cAnsPick.h"

#ifdef _MANAGED
#pragma managed(push, off)
#endif

/*
------------------------------ Function Description -----------------------
extfnc
int extfnc(uecmd)
char *uecmd;

Purpose:

Demonstrate C API entry function for an external command.

Parameters:

Input
-----------------------------
uecmd
The ANSYS external command string.

Output
-----------------------------

Return Value:
The return value is ignored by the calling function;

----------------------------- End Function Description --------------------
*/

int extfnc(char* uecmd)
{
/* Note: uecmd is the entire command given to invoke this function */
char* cmdsend = {"/COM, COMMAND SENT FROM EXTERNAL COMMAND"};
char* querystr = {"NODE,,NUM,MAX"};
char strrtn[32];
int i, itype;
double dblrtn;

/* Send a simple command to be executed */
i = cAnsSendCommand(cmdsend);

/* Perform a simple query */
// i = cAnsGetValue(querystr,&dblrtn,strrtn,&itype);

/* Display the value retrieved */
cAns_printf("Max Node Number = %g\n",dblrtn);

return (i);
}
/------------------------------------------------------------------------------------

It was compiled and make DLL files.
the DLL which was maden is test.dll

5. i made test.def file

EXPORTS

extfunc

6. i modified ANS_EXT.TBL in C:\Program Files\Ansys Inc\v121\ansys\lib\intel
and it's content is

%ANSYS121_DIR%\Lib\Intel\test.dll ~extfnc extfnc

I started Launcher and job name was test and directory was e:\ansys
then i copied test.def to e:\ansys

after launch ansys
i typed ~DEBUG

and i found

command library function accessed?
~extfnc c:\Program~\intel\test.dll test.dll no

i tired typing ~extfnc
but there is a error
"An error was detected while operation on a shared library:"

What did i wrong??

and
if i try to use "cAnsGetValue(querystr,&dblrtn,strrtn,&itype); " function
there was a link error
"Unresolved external symbol"

Do i have to include another lib files?

Is there anyone use only C/C++ for using UPF?

wonjae lee. korea aviation univ. KOREA.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    XANSYS Forum Index -> XANSYS
All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

sleek template created by Andrew Charron