[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

DLL's: is the memory cleaned?

Posted on 1998-09-21
1
Medium Priority
?
197 Views
Last Modified: 2013-12-27
I am using MATLAB 5.0 on Sun Sparc with Sun OS 4 and call some MEX routines, which are actually in a dinamically linked library. What I am trying to do is to have two MEX functions which are connected by some global variables. The first function initializes the vars, the 2nd one uses them. There are 2 separate calls from MATLAB to each routine. It seems that contents of the global vars are lost after the first call so that when the 2nd functiona attempts to use them it gets garbage. Looks like the library is loaded to and then unloaded from the memory each time it is called. Is there a way around this? Should that be an option for compiler (the MEX funs are written in C and compiled using acc), for MATLAB or for something else?

Thanks
0
Comment
Question by:ilyaz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 3

Accepted Solution

by:
braveheart earned 100 total points
ID: 2007057
What do you mean by global variables in this context?  Statics in C?  Common in FORTRAN?

Usually with shared libraries it is necessary to explicitly export such variables for them to be visible by different DLLs. This is because each DLL allocates its own memory for the "global" so the linker has to be told about them to make sure that they share the same memory.

See the ld man pages, particularly the -B family of options.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question