LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error transact.cpp when load LabWindows CVI DLL

Hie,

I'm a "newbie" about LabView, and I would like to call a simple LabWindows CVI DLL from LabView. Then for this
I did also a very simple VI (I think : 2 buttons, the first to call my DLL function and the second to quit
my VI). I define my DLL as indicated by NI, all seems OK. After placing and defining parameters about my
DLL function in the diagram, If I "double clic" on the DLL icon in my diagrram, I obtain :

"Failure Transact.cpp, line 1132 ...blabla...blabla".

Another Time, I obtained a message (when I try to run) about

"not enough memory"

the solution is then to kill LabView Process or shunt Down !!!!!

I've tried my "mini" projet on tow systems and I obtained the same results :
Wind
ows 2000 and Windows NT
LabView 6.0 et Lab Windows CVI 6.0
144 Ram and 256 Ram in the two PC and not another application running during my test :
I think then I should have enough ram to do this !


I did not see my problem

thank a lot in advance for any help

file attachement contain hardcopy of VI


Thierry
0 Kudos
Message 1 of 5
(2,846 Views)
There could of course be something in the DLL code that's causing the problem, but one WAG I would offer is are you sure the calling convention you have selected is correct?

Have you tried calling this DLL from some other environment?

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 5
(2,845 Views)
1./ I've Tried my "bug ?" DLL from a LabWindows CVI application (a callback function calls my DLL function)
and all is OK.

2./ Today, I've Developped a VERY simple DLL which contains just one function which return a numeric value
and all is OK when I used it From LABVIEW.

The difference between DLL in cases 1/ and 2/ is in case 1/ : I have a panel and not in case 2/.
The DLL in case 1/ is more "complicated", but I would precise my DLL function is a void function and
has no argument and in case 1/ : all is OK (when DLL is called From LabWindows application)
I think then my DLL is correctly writted for Labwindows environnement ?!?!

I don't know LABVIEW did with DLL containing User Interface....

I have then submit my problem to NI and I wait for
a response. Of course when I will have a solution
I will transmit you this one.


Thanks

Thierry
0 Kudos
Message 3 of 5
(2,845 Views)
hie,

Not the response with NI, but another little test with another environnement : "I've tried my Labwindows DLL (containing an User Interface Ressource) whith VB6.
-> All is OK !!

Anybody has tried LabView with DLL containing UIR ...?

Thierry
0 Kudos
Message 4 of 5
(2,845 Views)
Hie,

Now It's OK !!

After submitting my problem to NI, NI has transmitted to me a simple program :
a VI which simply calls a function in a DLL (which loads an UIR), and their solution runs.
Their solution is the "same" as mine except in mine, I have added calls to "MessagePopup"
just to study how running my program like this (see "// Here ->x" ) :


Extract of my code in my DLL :
----------------------------------------------------------------------------------------
int __stdcall DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
int iValue=0;

switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
"// Here ->1" MessagePopup ("Avertissement", "DLL -> Init Ressources DLL LabWindows");

if (InitCVIRTE (hinstDLL, 0, 0) == 0)
return 0; /* out of memory */
break;
case DLL_PROCESS_DETACH:
"// Here ->2" MessagePopup ("Avertissement", "DLL -> Free Ressources DLL LabWindows");

if (!CVIRTEHasBeenDetached())
{
CloseCVIRTE ();
}
break;
}
....
----------------------------------------------------------------------------------------

The problem is located to the line "// Here ->"

When I drag the icon "Call Librairie function" in the diagram of my VI and I define parameters,
immediately a "link" is established between LabView and the DLL, the __stdcall DllMain is called !

then LabView Environnement failed !, you have then to kill the LabView Process !

By changing the "MessagePopup" functions with tracks (*) in a file, I can "debug" my program and I will
have never this artefacts.


(*) :
change line // Here ->1 with TraceMsg("DLL -> Init Ressources DLL LabWindows");
change line // Here ->2 with TraceMsg("DLL -> Free Ressources DLL LabWindows");

void TraceMsg(char *szBuffer)
{

int iValue=0;
int iHandle=0;

iHandle = OpenFile("D:\\Thierry\\Formation LabView-LabWindows\\trace.log",
VAL_WRITE_ONLY, VAL_APPEND, VAL_ASCII);
iValue = WriteLine (iHandle, szBuffer,strlen(szBuffer));
iValue =CloseFile (iHandle);
}


Thierry
0 Kudos
Message 5 of 5
(2,845 Views)