The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Data corruption when calling external DLL

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
Klaus.Schm1 Posted - 04/08/2005 : 09:37:38 AM
Origin Version (Select Help-->About Origin): 75G SR3
Operating System: WinXP

I need to call C functions from an external DLL.
Everthing works fine except that for one function I get corrupted data except when I start Origin from the VS2003 debugger. If I step through the DLL'code from VS2003 when origin calls it everthing goes fine. If I run the DLL (both the Debug or Release build) stand allone in origin the data gets corrupted.

The function works fine btw. I called from a C test program and everything works OK. Only when calling it from Origin the memory gets corrupted.

Any suggestions ?

2   L A T E S T    R E P L I E S    (Newest First)
Klaus.Schm1 Posted - 04/11/2005 : 12:44:02 PM
Here you go the header file I use in origin. If you want the entire project plus DLL's just let me know

// Header file for origin
// Load the external DLL
#pragma dll(C:\Dokumente und Einstellungen\skl.IPP\Eigene Dateien\Visual Studio Projects\Diffusion\OriginStub\Release\Diffusion.dll)
#pragma dll(C:\Dokumente und Einstellungen\skl.IPP\Eigene Dateien\Visual Studio Projects\Diffusion\OriginStub\Release\OriginStub.dll)
// Interface for origin
// Set the current diffuion profile
int SetDiffusionProfile(double* pX, double* pC, int NumLayers);
// Returns the number of layers in the current diffusion profile
int GetNumLayers(void);
// Gets the C(X) diffusion profile data
int GetDiffusionProfile(double* pX, double* pC, int* pNumLayers, int MaxLayers);
// Set the current D(C)
int SetDofC(double* pC, double* pD, int NumEntry);
// Get the number of entries in the current D(C)
int GetNumDofCEntries(void);
// Get D(C)
int GetDofC(double* pC, double* pD, int* pNumEntry, int MaxEntries);
// Runs the diffusion code
// Constant D
int DiffusionProfileDConst(double D, double dt, int NumSteps, double MinVal, double MaxVal);
// Uses the current D(C)
int DiffusionProfileDofC(double dt, int NumSteps, double MinVal, double MaxVal);
// Performs BM-Analysis
int BMAnalysis(double Time, int MaxSteps, double Acc);
easwar Posted - 04/08/2005 : 5:14:59 PM
quote:

Origin Version (Select Help-->About Origin): 75G SR3
Operating System: WinXP

I need to call C functions from an external DLL.
Everthing works fine except that for one function I get corrupted data except when I start Origin from the VS2003 debugger. If I step through the DLL'code from VS2003 when origin calls it everthing goes fine. If I run the DLL (both the Debug or Release build) stand allone in origin the data gets corrupted.

The function works fine btw. I called from a C test program and everything works OK. Only when calling it from Origin the memory gets corrupted.

Any suggestions ?





Hi,

Can you post here the prototypes of the functions exported from your DLL?

Thanks,

Easwar
OriginLab


The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000