c - Segment violation writing to variable in DLL (lcc-win32) -


i've built dll few functions , global variables. i've used buildlib create import library it.

the .exp file is:

csc_ffsw.dll _csc_ffsw_b                _csc_ffsw_b        data _csc_ffsw_dwork            _csc_ffsw_dwork    data _csc_ffsw_m                _csc_ffsw_m        data _csc_ffsw_u                _csc_ffsw_u        data _csc_ffsw_y                _csc_ffsw_y        data _csc_ffsw_initialize       _csc_ffsw_initialize _csc_ffsw_step0            _csc_ffsw_step0 _csc_ffsw_step1            _csc_ffsw_step1 

when import dll program, can read global variables (e.g. csc_ffsw_u), when try write them segment violation exception.

instead of using import library, tried manually importing symbols dll using:

dllhandle = loadlibrary("csc_ffsw.dll"); mytype* pcsc_ffsw_u = (mytype*)getprocaddress(dllhandle, "_csc_ffsw_u"); ... etc. 

with approach can write variables fine. however, method not nice because requires more manual, error prone work.

should possible have read-write access variables in import library created buildlib? how should specify in .exp file?

many thanks,

miguel

the issue caused missing __declspec(dllimport) , __declspec(dllexport) in declaration of variables.

see https://groups.google.com/forum/#!topic/comp.compilers.lcc/friye0hmi04 more details.


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -