Import a "C" function that returns a struct...

  • Thread starter Thread starter Sam
  • Start date Start date
S

Sam

I have a .dll with "C" functions that I need to call. One of the
functions returns a simple struct(2 doubles)

If I try to use DllImport like this:

[ DllImport("somedll.dll]
SomeStruct1 f1(SomeStruct1 *pS);

I get compiler error C3385 "a function that has a DllImport Custom
Attribute cannot return an instance of a class"

How can I import a function from a DLL that returns a struct???

Thanks a ton,
Sam
 
æˆ‘è‹±è¯­ä¸æ˜¯å¾ˆå¥½ï¼Œæ‰€ä»¥çœ‹ä½ ä»¬çš„贴很åƒåŠ›ï¼Œæ‰€ä»¥æˆ‘æ— æ³•ç”¨E语回答
æˆ‘ä»¥å‰æ˜¯delphi程åºå‘˜ï¼Œå¯¹å®ƒä¹Ÿä¸æ˜¯ç ”究得特别的深,我但一直很喜欢VCï¼Œæˆ‘åœ¨å›½å†…çš„è®ºå›æé—®ï¼Œå¾ˆæœ‰äººè·Ÿæˆ‘è®²è§£ï¼Œæ‰€ä»¥æˆ‘ä¸€æ°”ä¹‹ä¸‹è·‘åˆ°è¿™é‡Œæ¥æï¼Œä¸ç®¡è¯­è¨€çš„问题,åªè¦æœ‰äººè·Ÿæˆ‘解答,我都会好好体会和学习的
 
Back
Top